[Cuis-dev] Some un-accurate information on The Cuis Book
Juan Vuletich
juan at cuis.st
Mon Feb 27 13:41:41 PST 2023
On 2/26/2023 10:48 AM, ken.dickey--- via Cuis-dev wrote:
> On 2023-02-26 05:31, ken.dickey--- via Cuis-dev wrote:
>
>> BTW, we can do better. I think -4+0i above should be and print as -4.
>
> Ah! The code is already there and just needed to be uncommented
> (attached).
>
> As we have Complex>>basicReal:imaginary: why does
> Complex>>real:imaginary not do the simplification? Can we not just
> enable this?
>
> Thanks,
> -KenD
Given that in Math, Complex is an extension of Real (and not of Integer
or Rational), I think that consistency with Floats is most important.
And Floats don't reduce to Integer (it would be a huge mistake to do
that). That's why the commented code in #real:imaginary: would only go
back if the imaginary part is not Float: doing it for Complex with Float
parts would be the same as converting 0.0 to 0.
And doing it differently for Complex with Float parts and with Integer
parts would not be simpler. It would be more complicated, and need this
extra explanation to make sense.
In the Number hierarchy, Float is like a pit you can't exit once you
fall into it. As Complex is an extension of Real, I think Complex should
do the same.
Maybe this rant should be in the comment at #real:imaginary:, after all.
Thanks,
--
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich
More information about the Cuis-dev
mailing list