Interval BUGS are well shared 2

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Interval BUGS are well shared 2

Nicolas Cellier-3
I just noticed another little oddity in Interval:

The Compiler optimized to:do: loop is not consistent with Interval>>do:
The former does
     value := value + step
While the later does
     value := start + (index*step)

Thus, we can exploit this to show how optimization changes the results:

| eps count |
eps := 1.0d0 timesTwoPower: -52.
count := 0.
1 + eps to: 2 do: [:x | count := count + 1].
(1 + eps to: 2) do: [:x | count := count - 1].
^count

result in a non null count.

Agree, Floating Point Interval are bad habit, and bug is minor, but...

Nicolas