Computes the value of a tangent.
#include <math.h> double atan2(double y, double x); float atan2f(float, float); long double atan2l(long double, long double);
These functions return the arctangent of y / x, in radians from -pi to pi. If y and x are 0, then these functions set errno to EDOM and
fpclassify(atan2(x))
returns FP_NAN.
This facility may not be available on configurations of the EWL that run on platforms that do not have floating-point math capabilities.
#include <math.h> #include <stdio.h> int main(void) { double x = 0.5, y = -1.0; printf("arccos (%f) = %f\n", x, acos(x)); printf("arcsin (%f) = %f\n", x, asin(x)); printf("arctan (%f) = %f\n", x, atan(x)); printf("arctan (%f / %f) = %f\n", y, x, atan2(y, x)); return 0; } Output: arccos (0.500000) = 1.047198 arcsin (0.500000) = 0.523599 arctan (0.500000) = 0.463648 arctan (-1.000000 / 0.500000) = -1.107149