[squeak-dev] Re: Exact #sqrt

Andreas Raab andreas.raab at gmx.de
Wed Oct 12 08:24:07 UTC 2011


On 10/12/2011 3:47, Juan Vuletich wrote:
> Yesterday I realized that there's no good reason for 8 sqrt to answer
> 2.0 and not just 2. To fix this inelegant situation I wrote the
> attached. This way, for instance, 4 sqrt = (8 raisedTo: 1/3) answers
> true. I also introduced #nthRoot: , which can be of some use. A rather
> complete set of tests is included, to illustrate the desired behavior.
>
> Feel free to comment, enhance, fix, etc, especially Nicolas, our
> numerics guru.

It looks really nice! I like it a lot.

> Oh, I saw the ongoing debate on automatically converting values to
> Complex, and therefore didn't include any change wrt that.

FWIW, I also agree with your comments regarding Complex vs. 
ComplexNumber and isComplex vs. isComplexXXX.

Cheers,
   - Andreas




More information about the Squeak-dev mailing list