Next: Exponents and Logarithms, Previous: Trig Functions, Up: Mathematics

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`)

— Function: floatasinf(float x)

— Function: long doubleasinl(long double x)

These functions compute the arc sine of

x—that is, the value whose sine isx. 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).The arc sine function is defined mathematically only over the domain

`-1`

to`1`

. Ifxis outside the domain,`asin`

signals a domain error.

— Function: double **acos** (`double x`)

— Function: floatacosf(float x)

— Function: long doubleacosl(long double x)

These functions compute the arc cosine of

x—that is, the value whose cosine isx. 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).The arc cosine function is defined mathematically only over the domain

`-1`

to`1`

. Ifxis outside the domain,`acos`

signals a domain error.

— Function: double **atan** (`double x`)

— Function: floatatanf(float x)

— Function: long doubleatanl(long double x)

These functions compute the arc tangent of

x—that is, the value whose tangent isx. 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`)

— Function: floatatan2f(float y, float x)

— Function: long doubleatan2l(long double y, long double x)

This function computes the arc tangent of

y/x, but the signs of both arguments are used to determine the quadrant of the result, andxis permitted to be zero. The return value is given in radians and is in the range`-pi`

to`pi`

, inclusive.If

xandyare 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 Exponents and Logarithms.)If both

xandyare zero,`atan2`

returns zero.

ISO C99 defines complex versions of the inverse trig functions.

— Function: complex double **casin** (`complex double z`)

— Function: complex floatcasinf(complex float z)

— Function: complex long doublecasinl(complex long double z)

These functions compute the complex arc sine of

z—that is, the value whose sine isz. The value returned is in radians.Unlike the real-valued functions,

`casin`

is defined for all values ofz.

— Function: complex double **cacos** (`complex double z`)

— Function: complex floatcacosf(complex float z)

— Function: complex long doublecacosl(complex long double z)

These functions compute the complex arc cosine of

z—that is, the value whose cosine isz. The value returned is in radians.Unlike the real-valued functions,

`cacos`

is defined for all values ofz.