411 REFERENCE · Wikibooks
C programming/math.h/atan
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
atan is a function in math.h.http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf
ISO/IEC 9899:1999 specification
p. 231, § 7.12.4.3 It computes arc tangent. It returns the principal value of the arc tangent of x, expressed in radians.
In trigonometrics, arc tangent is the inverse operation of tangent.
Note that because of sign ambiguity, function cannot determine in which quadrant the angle falls only by its tangent value. To determine quadrant, we can use atan2.
Return value of this function is principal arc tangent of x, in the interval [-pi/2,+pi/2] radians.
Syntax
#include <math.h>
double atan ( double x );
Here, x is Floating point value.
Example
#include <math.h>
#include <stdio.h>
#define PI 3.14159265
int main(void)
{
double param, result;
param = 1.0;
result = atan(param) * 180 / PI;
printf("The arc tangent of %lf is %lf degrees\n", param, result );
return 0;
}
Output
The arc tangent of 1.000000 is 45.000000 degrees.
References
External links
C++ reference for std::atan
deep