[ENH] Complex
Boris Gaertner
Boris.Gaertner at gmx.net
Tue Jul 20 20:56:50 UTC 2004
<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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: secureComplexDiv.1.cs
Type: application/octet-stream
Size: 2910 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040720/b987ed4d/secureComplexDiv.1.obj
More information about the Squeak-dev
mailing list
|