Free42 and cube root of complex number
02-24-2021, 02:02 AM
Post: #2
 Thomas Okken Senior Member Posts: 1,726 Joined: Feb 2014
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.)
 « Next Oldest | Next Newest »

 Messages In This Thread Free42 and cube root of complex number - Ajaja - 02-23-2021, 11:05 PM RE: Free42 and cube root of complex number - Thomas Okken - 02-24-2021 02:02 AM RE: Free42 and cube root of complex number - Albert Chan - 02-24-2021, 10:26 AM RE: Free42 and cube root of complex number - Paul Dale - 02-24-2021, 02:52 AM RE: Free42 and cube root of complex number - J-F Garnier - 02-24-2021, 08:28 AM RE: Free42 and cube root of complex number - Werner - 02-24-2021, 08:59 AM RE: Free42 and cube root of complex number - Thomas Okken - 02-24-2021, 01:35 PM RE: Free42 and cube root of complex number - Albert Chan - 02-24-2021, 02:47 PM RE: Free42 and cube root of complex number - Thomas Okken - 02-24-2021, 02:53 PM RE: Free42 and cube root of complex number - Werner - 02-25-2021, 06:08 AM RE: Free42 and cube root of complex number - Albert Chan - 02-25-2021, 04:40 PM

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