Name
atan
Synopsis
Calculates the inverse tangent of a number
#include <math.h> doubleatan
( doublex
); floatatanf
( floatx
); (C99) long doubleatanl
( long doublex
); (C99)
atan()
implements the
inverse tangent function, commonly called arc tangent.
The return value is given in radians, and is thus in the range
-π/2 ≤ atan
(x
) ≤
π/2.
Example
#ifdef PI
printf("The symbol PI was already defined.\n");
long double pi = (long double) PI;
#else
long double pi = 4.0L *atanl
( 1.0L ); // Because tan(pi/4) = 1
#endif
printf( "Assume pi equals %.17Lf.\n", pi);
This code produces the following output:
Assume pi equals 3.14159265358979324.
See Also
The arc tangent functions for complex numbers: catan()
, catanf()
, and catanl()
Get C in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.