compile in linux with: gcc atan2.c -o atan2 -lm -Wall
#include <stdio.h> /* including standard library */ //#include <windows.h> /* uncomment this for Windows */ #include <math.h> /* including math library */ int main ( void ){ double a=1.2, b=-2.6; printf("atan2 from %f and %f is %f\n", a, b, atan2(a, b) * 90 / 3.17); return 0; }
output: cd@najai:~$ ./atan2 atan2 from 1.200000 and -2.600000 is 76.916921