# issue with atan() function manual

## issue with atan() function manual

Intel® Fortran Compiler XE 13.1 User and Reference Guides
.....
Results
The result type and kind is the same as x and is expressed in radians. The value lies in the range -pi <= ATAN2 (y, x) <= pi.
If x is not zero, the result is approximately equal to the value of arctan (y/ x).
If y > zero, the result is positive.
If y < zero, the result is negative.
If y is zero and x > zero, the result is y (so for x>0, ATAN2 ((+0.0), x) is +0.0 and ATAN2 ((-0.0), x) is -0.0).
If y is a positive real zero and x < zero, the result is pi.
If y is a negative real zero and x < zero, the result is -pi.
If x is a positive real zero, the result is pi/2.
If y is a negative real zero, the result is -pi/2.

By testing:

type*,"(0d0,0d0)",atan2(0d0,0d0)
type*,"(0d0,-1d0)",atan2(0d0,-1d0)
type*,"(0d0,1d0)",atan2(0d0,1d0)
type*,"(-1d0,0d0)",atan2(-1d0,0d0)
type*,"(1d0,0d0)",atan2(1d0,0d0)

gives:
(0d0,0d0)   1.57079632679490
(0d0,-1d0)   3.14159265358979
(0d0,1d0)  0.000000000000000E+00
(-1d0,0d0)  -1.57079632679490
(1d0,0d0)   1.57079632679490

So the manual should allow x==y=0 instead of:

y

(Input) Must be of type real.

x

(Input) Must have the same type and kind parameters as y. If y has the value zero, x cannot have the value zero.

Besides, the second to last line in the above "Results: If x is a positive real zero, the result is pi/2" should be "If y is a positive real ....

Best regards,

Kong

2 posts / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.

I hope it didn't keep you awake at night!