cos
double cos ( double x ); | math.h |
cplusplus.com |
Calculate cosine.
Performs the trigonometric cosine operation on x returning a
value between -1 and 1.
Parameters.
Return Value.
Cosine of x.
Portability.
Defined in ANSI-C.
ANSI-C++ adds float and double overloaded versions of this function,
with the same bahavior but being both, parameter and result, of one of these types.
Example.
/* cos example */
#include <stdio.h>
#include <math.h>
#define PI 3.14159265
main ()
{
double param, result;
param = 45;
result = cos (param*PI/180);
printf ("Cosine of %lf degrees is %lf\n", param, result );
return 0;
}
Output:
Cosine of 45.000000 degrees is 0.707107
See also.
acos,
asin,
atan,
sin,
tan