MorphOS Developer
Posts: 510 from 2003/4/11
There's a bug in the C code, or at least a difference from how the Python version works.
In the from_y() function, replace
Code:
r.x = pow(y * y - C, 1.0/3);
with
Code:
double tmp;
tmp = y * y - C;
if (tmp >= 0)
r.x = pow(tmp, 1.0/3);
else
r.x = -pow(-tmp, 1.0/3);
That'll make it behave identically to the Python version, and also give an identical result.
The code as it is compiles fine for MorphOS, at least if you use GCC 4.
I rarely log in to MorphZone which means that I often miss private messages sent on here. If you wish to contact me, please email me at [username]@asgaard.morphos-team.net, where [username] is my username here on MorphZone.