Syntax
#include <math.h> double atan(double x); double atan2(double y, double x);Description
atan and atan2 calculate the arctangent of x and y/x, respectively.
atan returns a value in the range -pi/2 to pi/2 radians. atan2 returns a value in the range -pi to pi radians. If both arguments of atan2 are zero, the function sets errno to EDOM, and returns a value of 0.
This example calculates arctangents using the atan and atan2 functions.
#include <math.h> int main(void) { double a,b,c,d; c = 0.45; d = 0.23; a = atan(c); b = atan2(c, d); printf("atan( %lf ) = %lf\n", c, a); printf("atan2( %lf, %lf ) = %lf\n", c, d, b); return 0; /**************************************************************************** The output should be: atan( 0.450000 ) = 0.422854 atan2( 0.450000, 0.230000 ) = 1.098299 ****************************************************************************/ }Related Information