Re: Numeric problem in BlackBox 1.4

From: Dominik Gruntz <"Dominik>
Date: Mon, 17 Feb 2003 19:31:03 +0100

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

> I guess that 1.000000000000000001 is non-unity
> as an 80-bit IEEE number, but rounds to 1 when
> stored as a 64-bit IEEE number.
>
> As an example try x := Math.Pi()
>
> then later try
>
> x = Math.Pi(). The answer is FALSE.
>

The constants defined in a Module are stored in REAL
precision, so the above argument does not apply.
But you are right, 1+10^(-18) is not 1 in 80 bit IEEE,
but it is 1.0 in 64 (REAL) precision.

Given the following module, the command Test.Do
prints $FALSE.

- Dominik


MODULE Test;

    IMPORT StdLog, Math;

    PROCEDURE OnePlusTenToThePowerOfMinusEighteen(): REAL;
    BEGIN RETURN 1 + Math.IntPower(10, -18);
    END OnePlusTenToThePowerOfMinusEighteen;
    
    PROCEDURE Do*;
        VAR x: REAL;
    BEGIN
        x := OnePlusTenToThePowerOfMinusEighteen();
        StdLog.Bool(x = OnePlusTenToThePowerOfMinusEighteen());
    END Do;
    
END Test.


--------------------------------------------

To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
   blackbox-request{([at]})nowhere.xy

To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.

Send any problem reports or questions related to this email list to the list owner at
   owner-blackbox{([at]})nowhere.xy

Current posting policy:

a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead.

b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays.


----boundary-LibPST-iamunique-1244552500_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"

e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0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kZHJlc3MuXHBhcg0KXHBhcg0KU2VuZCBhbnkgcHJvYmxl
bSByZXBvcnRzIG9yIHF1ZXN0aW9ucyByZWxhdGVkIHRvIHRoaXMgZW1haWwgbGlzdCB0byB0aGUg
bGlzdCBvd25lciBhdFxwYXINCiAgIG93bmVyLWJsYWNrYm94QG9iZXJvbi5jaFxwYXINClxwYXIN
CkN1cnJlbnQgcG9zdGluZyBwb2xpY3k6XHBhcg0KXHBhcg0KYSkgVG8gcG9zdCB5b3Ugc2hvdWxk
IHVzZSB0aGUgc2FtZSBhZGRyZXNzIGJ5IHdoaWNoIHlvdSBhcmUgc3Vic2NyaWJlZCB0byB0aGUg
bWFpbGluZyBsaXN0LiBUaGF0IHdheSwgdGhlIGxpc3Qgc2VydmVyIHdpbGwgcmVjb2duaXplIHlv
dSBhcyBzdWJzY3JpYmVyIGFuZCBmb3J3YXJkIHlvdXIgcG9zdGluZyBpbW1lZGlhdGVseSwgd2l0
aG91dCBjcmVhdGluZyBhbnkgb3ZlcmhlYWQuXHBhcg0KXHBhcg0KYikgSWYsIGZvciBzb21lIHJl
YXNvbiwgeW91IGNhbm5vdCBwb3N0IGZyb20gdGhlIGFkZHJlc3MsIGJ5IHdoaWNoIHlvdSBhcmUg
c3Vic2NyaWJlZCwgeW91ciBtZXNzYWdlIHdpbGwgYmUgbW9kZXJhdGVkIHRvIGF2b2lkIHNwYW0u
IFBsZWFzZSB1bmRlcnN0YW5kIHRoYXQgbW9kZXJhdGlvbiB3aWxsIG9mdGVuIGNhdXNlIHNvbWUg
ZGVsYXksIGluIHBhcnRpY3VsYXIgb3ZlciB3ZWVrZW5kcyBvciBob2x5ZGF5fX0ALUVuY29k


----boundary-LibPST-iamunique-1244552500_-_---
Received on Mon Feb 17 2003 - 19:31:03 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:29:27 UTC