[Cuis-dev] Negative sqrt
Juan Vuletich
juan at jvuletich.org
Wed Dec 23 12:24:27 PST 2020
Hi Ken,
On 12/22/2020 5:42 PM, ken.dickey--- via Cuis-dev wrote:
> If approved, I would like the attached changeset integrated.
>
> Silly not to allow the user to require Complex with sqrt of a negative
> number.
>
> Such a nice example:
>
> -4 sqrt squared."--> -4 + 0 i "
>
> Cases I have missed?
>
> Thanks much,
> -KenD
It was done that way on purpose (and with a lot of care!). See all
references to NegativePowerError. The idea is that Complex is "advanced
mathematics". At some levels of maturity in Math (think primary school),
sqrt of negative numbers simply doesn't exist. But if the user knows
about Complex numbers, they can just `Feature require: 'Complex'` and
the examples now run as they should in this new, wider world.
If we assume all users are aware of complex numbers, we'd just integrate
them into the base image. It was like this some time ago.
Finally, arithmetic should not call the user interface. You never know
in what context that code will be running. It might run thousands times
in an inner loop, for example.
Thanks,
--
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
@JuanVuletich
More information about the Cuis-dev
mailing list