MOD function does not work! So be warned!

Michael D Mays michael at GreppyDreppies.com
Sun Mar 31 16:14:00 EST 2002


Dar Scott of dsc at swcp.com wrote the following on 3/31/02 11:49 AM

> It is not the loop, it is addition.  Every Revolution number (a
> priori) has a potential error.  This accumulates.  (I say "a
> priori" because some numbers, can be represented exactly.)

It is not a bug. This is just the way MOD and decimal numbers which are
represented as binary numbers work.

It is not just a Revolution problem.

The error does not accumulate. Try summing a million .10. There is no
accumulation.

Run this handler.

on mouseUp
  set the numberFormat to \
  "0.###############################################################"
  put ".100000000000000000,.100000000000000012,.100000000000000013" into inc
  repeat with j=1 to 3
    put item j of inc into incc
    put 0 into a
    repeat with i=1 to 10
      add incc to a
      put a&"" into a
      put "0."&i into ii
      put ii&"   "&a into line i+(j-1)*10 of fld 1
    end repeat
  end repeat
end mouseUp

michael




More information about the use-livecode mailing list