The term:
A = -sign(R)cbrt(abs(R) + sqrt(RR - QQQ))
can have a cancellation between a^6/729 and a^4b/81 in the expansion of R^2 and Q^3. Perhaps making these cancellations analytically will make this more stable to evaluate (although maybe this doesn't matter since these are added to |R|).
Also, this is a time-consuming line of code, so it would be nice to find a faster expression to evaluate.
The term: A = -sign(R)cbrt(abs(R) + sqrt(RR - QQQ))
can have a cancellation between
a^6/729
anda^4b/81
in the expansion ofR^2
andQ^3
. Perhaps making these cancellations analytically will make this more stable to evaluate (although maybe this doesn't matter since these are added to|R|
).Also, this is a time-consuming line of code, so it would be nice to find a faster expression to evaluate.