which fix is the best for Complex?

stéphane ducasse ducasse at iam.unibe.ch
Sun Jun 11 08:33:01 UTC 2006


Ok so could the mathematical guys sync and propose a nice solution  
and let me
know what to do?

Stef


On 10 juin 06, at 22:04, Matej Kosik wrote:

> Thomas Koenig wrote:
>> Steph, I recommend harvesting Nicolas cellier' fixes.  Certainly in
>> preference to mine (to in elegant) and even in preference to  
>> (isNumber
>> ignores issues discussed in Complex class comments.) Nicolas  
>> appears to have
>> spent the time working with Complex.  Tom
>>
>
> Hello,
>
> Once upon a time the `Complex' class was in a separate package called
> `Algebraic'. Its intention was to brings things like complex numbers,
> matrices, polynoms and such to the image. Since it was rather
> incomplete, I deleted it. Later someone put these classes into the  
> core
> image.
>
> The problem with the Complex class (and I thought that it was obvious)
> is, that it cannot be implemented correctly without traits. Complex
> certainly is a number (roughly) (you can do arithmetic with it, it  
> plays
> well with other numbers etc). The problem is, that it is not a  
> magnitude
> (they cannot be sensibly totally ordered).
>
> Other things are problematic. If `Complex' is a `Number' then methods:
>
> 	to:
> 	to:by:
> 	to:by:do:
> 	to:do:
> 	even
> 	odd
> 	isDivisibleBy:
> 	negative
> 	positive
> 	sign
> 	strictlyPositive
> 	ceiling
> 	detentBy: detent atMultiplesOf: grid snap: snap
> 	floor
> 	fractionPart
> 	integerPart
> 	reduce
> 	roundTo:
> 	roundUpTo:
> 	rounded
> 	truncateTo:
> 	truncated
>
> do not have sense.
>
> Finer classification would be more appropriate, but the whole stuff
> would be a bit more complicated. I am not sure if it could be done
> without traits (I guess).
> -- 
> Matej Kosik
>




More information about the Squeak-dev mailing list