----boundary-LibPST-iamunique-741906704_-_-
Content-type: text/plain
Wojtek,
The exact value of 1.000000000000000001 can't be stored in a variable of
type REAL. That's why the compiler truncates this number to r = 1.0 in the
assignment r := 1.000000000000000001. You can check this in the debugger by
inserting a HALT statement after the assignment.
Best regards,
Marc
Oberon microsystems, Inc.
> -----Original Message-----
> From: Wojtek Skulski [mailto:skulski{([at]})nowhere.xy> Sent: Sonntag, 16. Februar 2003 04:52
> To: support{([at]})nowhere.xy> Cc: Wojtek Skulski; BlackBox
> Subject: Numeric problem in BlackBox 1.4
>
>
> 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.
--------------------------------------------
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-741906704_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIFdvanRlayxccGFyDQpccGFyDQpUaGUgZXhhY3Qg
dmFsdWUgb2YgMS4wMDAwMDAwMDAwMDAwMDAwMDEgY2FuJ3QgYmUgc3RvcmVkIGluIGEgdmFyaWFi
bGUgb2ZccGFyDQp0eXBlIFJFQUwuIFRoYXQncyB3aHkgdGhlIGNvbXBpbGVyIHRydW5jYXRlcyB0
aGlzIG51bWJlciB0byByID0gMS4wIGluIHRoZVxwYXINCmFzc2ln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