Increment bug in repeat loops

stephen barncard stephenREVOLUTION2 at barncard.com
Fri Nov 20 23:13:05 EST 2009


but it works if you set the numberformat  to match

on mouseUp

      put empty into  fld "results"

      --set the numberFormat to "#.##################"

      set the numberFormat to "#.#"

      put 0 into j

      repeat with i = 0 to 11 -- for demonstration

            add 0.1 to j

            put i & " : " & j & return after fld "results"

      end repeat

end mouseUp



0 : 0.1

1 : 0.2

2 : 0.3

3 : 0.4

4 : 0.5

5 : 0.6

6 : 0.7

7 : 0.8

8 : 0.9

9 : 1

10 : 1.1

11 : 1.2


-------------------------
Stephen Barncard
San Francisco
http://houseofcubes.com/disco.irev


2009/11/20 <DunbarX at aol.com>

> I get all that, and should have realized that decimals are not quite what
> they seem. I knew that.
>
> I got caught up in the fact that they were a function of some binary
> pattern. Without going into the 19th decimal place, this is probably not
> even a
> mystery.
>
> Craig Newman
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list