MOD function does not work! So be warned!

Dar Scott dsc at swcp.com
Thu Mar 28 23:49:01 EST 2002


On Thursday, March 28, 2002, at 09:06 PM, David Vaughan wrote:

> Interesting bug. I changed your startpoint and endpoint to 4.9 & 5 
> with no bug and 4.8 & 5 with the bug.
> Changing the critical line to "put loop && round(loop) mod 5 & 
> return after msg" disposes of the error so I it seems to be a 
> trailing digits error in real arithmetic rather than a logical bug 
> as such. "5 mod 5" of course always produces 0.

This is discouraging.  I typed ".2 + .2 + .2 + .2 + .2 = 10 into 
the message window and got false.

I assume by real you mean floating point, as typically implemented 
by computer hardware, a number with a binary point.  I don't see 
anything in the documentation as numbers being sometimes 
implemented as floating point.

I wouldn't mind this if it is transparent.  As long as a value 
looks and acts like a string, I don't care how it is stored 
internally.

As far as rounding, without evidence to the contrary one would have 
to assume that numbers are rounded to a decimal point rather than 
to a binary point.  (Numbers don't have to be represented in 
decimal for a decimal point to be maintained, but they often are.)

The implication is that applications that need a decimal point need 
to have lots of special code.
Dar Scott




More information about the use-livecode mailing list