Re: [BLACKBOX] CONSTant expressions

From: [at]} <CFB>
Date: Sat, 19 Jan 2008 17:10:43 +1030

----boundary-LibPST-iamunique-1009114775_-_-
Content-type: text/plain

> -----Original Message-----
> From: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy
> Sent: Saturday, 19 January 2008 4:35 AM
> To: BLACKBOX{([at]})nowhere.xy
> Subject: Re: [BLACKBOX] CONSTant expressions
>
>
> In my example module I think the first three results are
> correct. The forth
> result is evidence that the Component Pascal compiler's
> handling of constants
> not only gets division by zero wrong, it gets multiplication
> by zero wrong also.
>
> OutBool ('zero1 = xero2 ? ', zero1 = zero2); (* TRUE *)
...
> OutBool ('inf1 = inf2 ? ', inf1 = inf2); (* FALSE *)
...
> OutBool ('pi = Pi ? ', pi = Math.Pi ()); (* FALSE *)
...
> OutBool ('inf1 = inf2 ? ', inf1 = inf2); (* TRUE *)

I would have expected the third result to be TRUE - have I fallen into a
carefully-laid trap?

I translated your example as closely as possible to Gardens Point Component
Pascal and C#. When running both on .NET I obtained the following output:

===
C#
===
zero1 = xero2 ? TRUE
inf1 = inf2 ? FALSE
pi = Pi ? TRUE
inf1 = inf2 ? FALSE

====
GPCP
====
zero1 = xero2 ? TRUE
inf1 = inf2 ? FALSE
pi = Pi ? TRUE
inf1 = inf2 ? TRUE

Three different systems, three different results! Remember - you are using
software designed by computer scientists on hardware designed by electronic
engineers. Whatever makes you think they should behave like mathematicians
;-)

Regards,
Chris

Chris Burrows
CFB Software
http://www.cfbsoftware.com/cp


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-1009114775_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ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HBhcg0KaW5mMSAgPSBpbmYyICAgICA/
ICAgVFJVRVxwYXINClxwYXINClRocmVlIGRpZmZlcmVudCBzeXN0ZW1zLCB0aHJlZSBkaWZmZXJl
bnQgcmVzdWx0cyEgUmVtZW1iZXIgLSB5b3UgYXJlIHVzaW5nXHBhcg0Kc29mdHdhcmUgZGVzaWdu
ZWQgYnkgY29tcHV0ZXIgc2NpZW50aXN0cyBvbiBoYXJkd2FyZSBkZXNpZ25lZCBieSBlbGVjdHJv
bmljXHBhcg0KZW5naW5lZXJzLiBXaGF0ZXZlciBtYWtlcyB5b3UgdGhpbmsgdGhleSBzaG91bGQg
YmVoYXZlIGxpa2UgbWF0aGVtYXRpY2lhbnNccGFyDQo7LSkgXHBhcg0KXHBhcg0KUmVnYXJkcyxc
cGFyDQpDaHJpcyBccGFyDQpccGFyDQpDaHJpcyBCdXJyb3dzXHBhcg0KQ0ZCIFNvZnR3YXJlXHBh
cg0KaHR0cDovL3d3dy5jZmJzb2Z0d2FyZS5jb20vY3BccGFyDQpccGFyDQpccGFyDQotLS0tXHBh
cg0KVG8gdW5zdWJzY3JpYmUsIHNlbmQgYSBtZXNzYWdlIHdpdGggYm9keSAiU0lHTk9GRiBCTEFD
S0JPWCIgdG8gTElTVFNFUlZATElTVFMuT0JFUk9OLkNIXHBhcg0KfQ==
----boundary-LibPST-iamunique-1009114775_-_---
Received on Sat Jan 19 2008 - 07:40:43 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:31:10 UTC