[BUG] Dictionary equality test

Richard A. O'Keefe ok at cs.otago.ac.nz
Tue Jun 18 02:42:48 UTC 2002


I wrote:
    1/2 = 0.5  ===> true
but (0.5 raisedTo: 3000) = (1/2 raisedTo: 3000)  ===> false

There's an even nastier consequence of the way Squeak handles equality
for numbers:  it's not transitive.  We can easily find numbers x y z
such that
    s := Set with: x with: y.
    s allSatisfy: [:each | each = z]  ===> true
but
    s size  ===> 2	
or to put it another way,
    x = z and: [z = y and: [(x = y) not]]  ===> true

We do NOT accept this as an argument for not having equality on Numbers
do we?

(My one contribution to Common Lisp was to point out this problem.
 As far as I know, they recognised it as a bug and fixed it...)

[Answer:
    t := 2 raisedTo: 58.
    x := (t-1)/t.
    y := (t+1)/t.
    z := 1.0.]




More information about the Squeak-dev mailing list