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.html :)
Nicolas 2009/8/13 Ken.Dickey <[email protected]>: > 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 > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
