Ken, as Bill already noticed, there might be a difference between an exact zero (0) and an inexact zero (0.0). Isn't that difference emphasized in Scheme? That reminds me http://lists.squeakfoundation.org/pipermail/squeak-dev/2006-April/102247.htm... :) Nicolas 2009/8/13 Ken.Dickey <Ken.Dickey@whidbey.com>:
OK, here is a strict version. Â Complex>>< only compares numbers on the real or imaginal axis and throws an "incomparable" error otherwise. Â The ComplexTest>>textCompare checks obvious cases.
Is this version (more) acceptable?
As usual, please feel free to correct (or send me corrections) for better coding style (e.g a shorter/better error message) as well as any dumbness on my part.
Cheers, -KenD ------------------------Complex < other     "Can only compare with pure real or imaginary parts"     ((self imaginary = 0) and: [other imaginary = 0])     ifTrue: [^ self real < other real]     ifFalse: [((self real = 0) and: [other real = 0])         ifTrue: [^self imaginary < other imaginary]         ifFalse: [ArithmeticError new             signal: 'Complex numbers are not generally comparable'.]         ] ------------------------
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project