Closed JorisDeRidder closed 2 years ago
- I added extra unit tests. The relevant values were taken from this page.
Could you please add that reference link as a comment in the test?
- I added extra unit tests. The relevant values were taken from this page.
Could you please add that reference link as a comment in the test?
OK. Done.
A gentle reminder...
bors r+
Build succeeded:
Why this PR?
The current version of the complex exp() function is not able to handle arguments that contain +/- inf or NaN in their real or imaginary part. This impacts other complex functions that use the exp() function.
For example, for the most widely used implementation of the complex Faddeeva function
w()
, the currentexp()
implementation leads tow(1e160 - 1e159*i) = NaN + NaN *i
, while the correct value is-5.586035480670854e-162 + 5.5860354806708545e-161 * i
. The underlying reason is that the currentexp()
implementation erroneously returnsexp(-inf + inf *i) = NaN + Nan *i
instead of the correct0 + 0*i
.Cf also issue #103.
Contents of this PR
<complex>
C++ header that comes with clang++.close_naninf()
andclose_naninf_to_tol()
as the existing functionsclose()
andclose_to_tol()
are not able to deal with inf and nan.