MOD function does not work! So be warned!

Michael D Mays mdmays at airmail.net
Thu Apr 4 11:09:00 EST 2002


It's not 5 Rob its 4.9999999... .

It only looks like 5 because the default numberFormat rounds it to 5. If you
set the numberFormat to a high enough precision you will see that the number
which is else rounded to the default numberFormat and displayed in the
message box is not 5.

anyIntegerNumber MOD 5 is never 5.

certainRealNumbers MOD 5 can look like 5 when rounded.

The default numberFormat wraps the MOD function with a round function which
rounds 4.9999999... to 5.

michael

Rob Cozens of rcozens at pon.net wrote the following on 4/4/02 9:08 AM

>> MOD is working. = is working.
> 
> Michael,
> 
> MOD is NOT working: anyNumber mod 5 CANNOT = 5.




More information about the use-livecode mailing list