num-complex icon indicating copy to clipboard operation
num-complex copied to clipboard

`Complex::sqrt()` does not produce cross-system reproducible results

Open Muon opened this issue 9 months ago • 2 comments

In the current implementation, computing the argument of a complex number depends on the system math library's implementation of atan2, which is not guaranteed to produce exactly rounded (or otherwise portably reproducible) results. However, the principal complex square root can be computed using only the usual correctly rounded operations (+, -, *, /, sqrt), which are reproducible on all IEEE 754 systems.

Muon avatar Mar 25 '25 01:03 Muon

Would #129 address that sufficiently? If not, do you have a problematic example?

cuviper avatar Mar 25 '25 01:03 cuviper

Yes, that should work perfectly! Sorry, missed it when I was searching.

Muon avatar Mar 25 '25 03:03 Muon