[BUG] Complex equality problem
nicolas cellier
ncellier at ifrance.com
Tue Feb 7 23:19:26 UTC 2006
Testing equality
aNumber = (aNumber + 0 i)
will answer false...
Testing equality
(aNumber + 0 i) = aNumber
will answer true...
(1 + 0 i) = 1.
1 = (1 + 0 i).
This is due to premature test
isNumber ifFalse [^false].
Obviously, Complex cannot answer true to isNumber because most senders of this
message will trust faithfully isKindOf: Number, and Complex is not in this
hierarchy.
The test should be some sort of
isArithmeticValue ifFalse: [^false]
and Complex Quaternion and other arithmetic classes extending numbers should
answer true to isArithmeticValue.
This is another clue that VW ArithmeticValue superclass of Number make sense.
And another clue that Complex (ComplexNumber please) are not much used.
More information about the Squeak-dev
mailing list
|