PolyMath
PolyMath copied to clipboard
More robust implementation of PMComplex >> sqrt
The implementation of PMComplex >> sqrt was improved in PR #221.
However, this implementation still suffers from potential floating point overflow/underflow. This is why I suggest something even more robust (and more accurate) like:
Implementing Complex Elementary Function Using Exception Handling ACM Transactions on Mathematical Software - October 1994 Ping Tang and 3 other authors
See https://source.squeak.org/trunk/Kernel-nice.1459.diff
I guess we can reuse quite easily the Squeak implementation done by @nicolas-cellier-aka-nice
Just correct the comment: it does not pick the root with positive imaginary part, but rather the root with positive integer part and same sign bit for imaginary part...
And also correct pure imaginary section ! See https://source.squeak.org/trunk/Kernel-nice.1460.diff