## 9.3.19 ATAN2 (Y, X)

Description: | Produces an arctangent. The result is the principal value of the argument of the nonzero complex number (X, Y).
Class: | Elemental function; Generic
Arguments: | Y | Must be of type real.
| X | 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 is the same as X and is expressed in radians. The value lies in the range -pi < ATAN2 (Y, X) <= pi. If X /= 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 = zero, the result is zero (if X > zero) or pi (if X < zero). If X = zero, the absolute value of 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)

Examples

ATAN2 (2.679676, 1.0) has the value 1.213623.

If Y has the value

      [  1   1 ]
      [ -1  -1 ]

and X has the value

      [ -1  1 ]
      [ -1  1 ],

then ATAN2 (Y, X) is

Previous Page Next Page Table of Contents