Post Reply 
Free42 and cube root of complex number
02-24-2021, 02:02 AM
Post: #2
RE: Free42 and cube root of complex number
In the first case, the imaginary part is -0, while in the second case, it is 0.
-0, also known as signed zero, is a feature of IEEE-754 floating point. The difference between 0 and -0 shouldn't matter in Free42, but apparently this is a case where it does and where there is no special-case code for zero to prevent this behavior.

What happens internally is that the number is first converted to polar using the hypot() and atan2() functions, and atan2(-0, -8) => -pi, while atan2(0, -8) => pi. After multiplying that angle by 1/3, you end up on opposite sides of the real axis.

I'll fix this in the next release.

(You won't see this behavior in ->POL, because it does contain special-case code for handling zero in either coordinate.)
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Free42 and cube root of complex number - Thomas Okken - 02-24-2021 02:02 AM



User(s) browsing this thread: 1 Guest(s)