Go to the first, previous, next, last section, table of contents.


Inverse Trigonometric Functions

These are the usual arc sine, arc cosine and arc tangent functions, which are the inverses of the sine, cosine and tangent functions, respectively.

Function: double asin (double x)
This function computes the arc sine of x---that is, the value whose sine is x. The value is in units of radians. Mathematically, there are infinitely many such values; the one actually returned is the one between -pi/2 and pi/2 (inclusive).

asin fails, and sets errno to EDOM, if x is out of range. The arc sine function is defined mathematically only over the domain -1 to 1.

Function: double acos (double x)
This function computes the arc cosine of x---that is, the value whose cosine is x. The value is in units of radians. Mathematically, there are infinitely many such values; the one actually returned is the one between 0 and pi (inclusive).

acos fails, and sets errno to EDOM, if x is out of range. The arc cosine function is defined mathematically only over the domain -1 to 1.

Function: double atan (double x)
This function computes the arc tangent of x---that is, the value whose tangent is x. The value is in units of radians. Mathematically, there are infinitely many such values; the one actually returned is the one between -pi/2 and pi/2 (inclusive).

Function: double atan2 (double y, double x)
This is the two argument arc tangent function. It is similar to computing the arc tangent of y/x, except that the signs of both arguments are used to determine the quadrant of the result, and x is permitted to be zero. The return value is given in radians and is in the range -pi to pi, inclusive.

If x and y are coordinates of a point in the plane, atan2 returns the signed angle between the line from the origin to that point and the x-axis. Thus, atan2 is useful for converting Cartesian coordinates to polar coordinates. (To compute the radial coordinate, use hypot; see section Exponentiation and Logarithms.)

The function atan2 sets errno to EDOM if both x and y are zero; the return value is not defined in this case.


Go to the first, previous, next, last section, table of contents.