atan2

Date:

10-12-2011

NAME

ATAN2, DATAN2, ATAN2D, DATAN2D - Compute arctangent (inverse tangent) for two arguments

SYNOPSIS

ATAN2 ([Y=]y,[X=]x)
DATAN2 ([Y=]y,[X=]x)
ATAN2D ([Y=]y,[X=]x)
DATAN2D ([Y=]y,[X=]x)

STANDARDS

Fortran

Fortran extensions: ATAN2D, DATAN2D

DESCRIPTION

ATAN2 and DATAN2 return the arc tangent, for two arguments, in radians. ATAN2D and DATAN2D return the arc tangent, for two arguments, in degrees. These intrinsics accept the following arguments:

y

Must be type real. For DATAN2 and DATAN2D, must be of type double precision. See the RETURN VALUES section for information on input data types and return values.

  • For ATAN2 and DATAN2, the following rules apply:

    • If y is positive, the result is positive.

    • If y is negative, the result is negative.

    • If y is positive or negative zero, and if x is positive, the result is positive or negative zero.

    • If y is positive or negative zero, and if x is negative, the result is positive or negative pi.

    • If y is zero, x cannot also be zero.

  • For ATAN2D and DATAN2D, the following rules apply:

    • If y is positive, the result is positive.

    • If y is negative, the result is negative.

    • If y is zero, and if x is positive, the result is zero.

    • If y is zero, and if x is negative, the result is 180.0.

    • If y is zero, x cannot also be zero.

x

Must be of type real. For DATAN2 and DATAN2D, must be of type double-precision. See the RETURN VALUES section for information on input data types and return values.

  • For ATAN2 and DATAN2, the following rules apply:

    • If x is zero, y cannot also be zero.

    • If x is zero, the value of the absolute value of the result is pi/2.

  • For ATAN2D and DATAN2D, the following rules apply:

    • If x is zero, y cannot also be zero.

    • If x is zero, the absolute value of the result is 90.0.

ATAN2 and ATAN2D are generic function names; the others are specifics. These are elemental intrinsic functions.

There are vector versions of the ATAN2 and DATAN2 intrinsics.

These functions evaluate y = arctan(y/x).

The result range, in radians, for ATAN2 and DATAN2 is -pi <= result <= pi.

The result range, in degrees, for ATAN2D and DATAN2D is -180 <= result <= 180.

NOTES

The ATAN2 and DATAN2 intrinsic function names can be passed as arguments; the others cannot.

Note: The atan2() function has a Linux-equivalent name. Use the man -aname option to show all manual pages matching name within the MANPATH search path. Manual pages are displayed in the order found.

RETURN VALUES

ATAN2 and ATAN2D return the real arc tangent of the quotient of their real arguments.

DATAN2 and DATAN2D return the double-precision arc tangent of the quotient of their double-precision arguments.