[Cuis-dev] Negative sqrt

Juan Vuletich juan at jvuletich.org
Mon Dec 28 10:46:56 PST 2020


On 12/23/2020 6:12 PM, Gerald Klix via Cuis-dev wrote:
>
>
> 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€.

Ok. Making the existence of the Complex package easier to discover is a 
good idea. Just pushed an update, in the #defaultAction of 
NegativePowerError. Please take a look.

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