[ENH] Complex

stéphane ducasse ducasse at iam.unibe.ch
Wed Jul 21 06:45:23 UTC 2004


Thanks boris. I think that complex is an important class showing the 
power of smalltalk class extension.
Have you look at the tests I sent recently? I built them reading the 
original code of Matej.
It would be nice to have your eyes on that. Marcus told me that I 
introduce a test for isNaN which
does not make sense. So if you have a look, remove it and resend 
possibly with more fixes.

Stef

On 20 juil. 04, at 22:56, Boris Gaertner wrote:

> <denker at iam.unibe.ch> wrote:
> To: <squeak-dev at lists.squeakfoundation.org>
>
> <snip>
>
>> from preamble:
>>
>> "Change Set: Complex
>> Date: 16 July 2004
>> Author: Matej Kosik
>>
>> md: This is just a first stab at an implementation of Complex. This 
>> will
>> definitly need improvements, but the base functionality is there.
>>  -removed Matrix, fixed undef references
>>  -added test class.
> </snip>
>
> After a quit test, I think that this is good work.
> There is one method that should be reconsidered:
> complex division.
>
> Look at this example:
>
>   | c1 c2 quotient |
>   c1 := 2.0e252 + 3.0e70 i.
>   c2 := c1.
>   quotient := c1 / c2.
>
> The result should be  1.0 + 0.0 i
> but we get an arithmetic overflow.
>
> There are algorithms that can avoid arithmetic overflow.
> These algorithms use scaling of operands.
>
> Attached you find a change set with two such algorithms
> :
> * an added method  #divideSecureBy: (required six divisions)
> * an added method #divideFastAndSecureBy: (requires only three 
> divisions)
> * three additional tests for complex division.
>
> Just my two eurocents
>
> Greetings, Boris
>
> <secureComplexDiv.1.cs>




More information about the Squeak-dev mailing list