Numeric problem in BlackBox 1.4

From: [at]} <Wojtek>
Date: Sat, 15 Feb 2003 22:52:02 -0500 (EST)

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

Hello:

  the following code illustrates a numeric problem with CP
compiler, version BlackBox 1.4 unpatched. The comparison
yields either TRUE or FALSE depending on the precision
of the REAL number. (Try exchanging the order of the
lines where the REAL variable is assigned). The language
report does not say anything about such a mixed comparison
(realVar = intVar). In the spirit of robustness I would
rather prefer that this expression does not compile at all.
ENTIER should be necessary, rather than relying on
rounding the REAL variable in some implicit way.

Excuse me if this was already patched.

Wojtek Skulski skulski{([at]})nowhere.xy

MODULE TestEqual;
IMPORT StdLog;
PROCEDURE Test*;
        VAR
        tst: BOOLEAN;
        r: REAL; long: LONGINT; int: INTEGER;
BEGIN
        long := 1; int := 1;
        r := 1.000000000000000001; (* TRUE*)
        r := 1.0000000000001; (* FALSE*)
        tst := (r = long);
        StdLog.String("Real = long: ");
        StdLog.Bool (tst); StdLog.Ln;
        tst := (r = int);
        StdLog.String("Real = int: ");
        StdLog.Bool (tst); StdLog.Ln;
END Test;
END TestEqual.

TestEqual.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-726919825_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"

e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbD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