|
| cos| Summary | |
#include <math.h>
float cos (
float x); /* number to calculate cosine for */
| | Description | | The cos function calculates the cosine of the floating-point value x. The value of x must be between -65535 and 65535. Values outside this range result in an NaN error. | | Return Value | | The cos function returns the cosine for the value x. | | See Also | | cos517, sin, sin517, tan, tan517 | | Example | |
#include <math.h>
#include <stdio.h> /* for printf */
void tst_cos (void) {
float x;
float y;
for (x = 0; x < (2 * 3.1415); x += 0.1) {
y = cos (x);
printf ("COS(%f) = %f\n", x, y);
}
}
|
|
|