PolyMath icon indicating copy to clipboard operation
PolyMath copied to clipboard

More robust implementation of PMComplex >> sqrt

Open olekscode opened this issue 3 years ago • 3 comments

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

olekscode avatar Apr 24 '22 11:04 olekscode

I guess we can reuse quite easily the Squeak implementation done by @nicolas-cellier-aka-nice

SergeStinckwich avatar Apr 24 '22 12:04 SergeStinckwich

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