[Cuis-dev] Negative sqrt

Gerald Klix cuis.01 at klix.ch
Wed Dec 23 13:12:55 PST 2020



On 2020-12-23 21:24, Juan Vuletich via Cuis-dev wrote:
> 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.
Yep, agreed.
> 
> Thanks,
> 
IHMO it would be sensible to pop up Ken's menu when the user/programer 
resumes the NegativePowerError exception.


Again, just my 0.04€.


More information about the Cuis-dev mailing list