Intel® Fortran Compiler 16.0 User and Reference Guide

ATAN2

Elemental Intrinsic Function (Generic): Produces an arctangent (inverse tangent). The result is the principal value of the argument of the nonzero complex number (x, y).

result = ATAN2 (y,x)

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.

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.

Specific Name

Argument Type

Result Type

ATAN2

REAL(4)

REAL(4)

DATAN2

REAL(8)

REAL(8)

QATAN2

REAL(16)

REAL(16)

Example

ATAN2 (2.679676, 1.0) has the value 1.213623.

If Y is an array that has the value

  [  1   1 ]
  [ -1  -1 ]

and X is an array that has the value

  [ -1  1 ]
  [ -1  1 ],

then ATAN2 (Y, X) is

atan2.gif