[squeak-dev] #compareSafely: and complex numbers
Thiede, Christoph
Christoph.Thiede at student.hpi.uni-potsdam.de
Thu Sep 26 11:12:06 UTC 2019
Hi all,
I just found out that the following throws a DNU:
1 compareSafely: 1 i.
It is mathematically correct that Complex does not implement #<. However, why does Complex override #isNumber to return true? Where is this used?
Should we maybe check in Number>>#compareSafely: whether aNumber respondsTo: #<? Or introduce something like #isMagnitude?
Number>>compareSafely: aNumber
^ (aNumber isNumber and: [aNumber isMagnitude])
ifTrue: [ self < aNumber ]
ifFalse: [ super compareSafely: aNumber ]
Best,
Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190926/e92a5013/attachment.html>
More information about the Squeak-dev
mailing list
|