Loading...
Select Version
&pagelevel(4)&pagelevel
Definition | #include <math.h> double cos(double x); These functions calculate the trigonometric function cosine for the floating-point number x. |
Return val. |
|
Example | The following program lists the cosine values corresponding to input values in the interval [-pi, +pi]. #include <math.h> #include <stdio.h> #define pi 3.14159265358979 int main(void) { double x; for (x = -pi; x <= pi; x = x + pi/4.) printf("cos(%f) = %f\n", x, cos(x)); return 0; } |
See also | acos, cosh, sin, asin, sinh, tan, atan, atan2, tanh |