Complex numbers (was Re: Roadmap proposal for 3.10/4.0)
bert at freudenbergs.de
Tue Oct 17 09:52:52 UTC 2006
Am 17.10.2006 um 03:45 schrieb Ken Dickey:
> I'd like to raise the idea of changing the complex number code in
> See change set at:
> Current (3.8/3.9):
> 2i isNumber. "false"
> -4 ln. "NaN"
> -4 sqrt. "exception"
> Alternate Code:
> 2i isNumber. "true"
> -4 ln. "(1.38629436111989 +3.141592653589793i)"
> -4 sqrt. "2.0i"
> I consider this a "community issue".
> - Are there users of complex numbers (does anyone care)?
> - Assuming yes, are there objective criteria for choosing between
> + behavior/completeness/test-cases
> + performance (I suspect that "the wrong answer fast" is not the
> way as we can always augment the primOps)
> + complex number user community vote
> + other...?
> I am actually agnostic as to which code base gets chosen, but we
> really should
> get the answers right.
Well, in best Smalltalk tradition I would vote for the alternate
code. It's similar to fractional arithmetic ( 3 / 4 ). Yes, fractions
bite some newbies, but they learn to use #// or #asFloat fast enough.
Same here - if you need an error when taking a negative's square
root, send #asFloat.
It's also a bit similar to Smalltalk being one of the few systems
with correct integers, where a bug like this is not possible:
I'd like to have no arbitrary limits, like forbidding to take the
logarithm of negative numbers.
- Bert -
More information about the Squeak-dev