Quantcast
Channel: Fortran
Viewing all articles
Browse latest Browse all 3108

Complex logarithm

$
0
0

Hello all,

according to the "Intel Fortran Libraries Reference", the natural logarithm of a complex number should give complex values x+i*y with -pi < y <= pi. But:

write(*,*) log((-1d0,0d0)),log(-(1d0,0d0))

yields the following output

 (0.000000000000000E+000,3.14159265358979)
 (0.000000000000000E+000,-3.14159265358979)

although the results should be identical and the imaginary part should NOT be -pi. I see this with versions 12 and 15. (In the final version of the code, where several complex logarithms are added up, the compilers behave differently, however, leading to correct results with v12 and incorrect results with v15. This complexity is lost after simplifying it to the above example.)

Thank you.

Christoph

 


Viewing all articles
Browse latest Browse all 3108

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>