Computes the cosine.
#include <math.h>
float cosf (x)
float x;
long double cosl (x)
long double x;
double cos (x)
double x;
_Decimal32 cosd32 (x)
_Decimal32 x;
_Decimal64 cosd64 (x)
_Decimal64 x;
_Decimal128 cosd128 (x)
_Decimal128 x;
The cosf, cosl, cos, cosd32, cosd64, and cosd218 subroutines compute the cosine of the x, parameter (measured in radians).
An application wishing to check for error situations should set errno to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these subroutines. Upon return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.
Item | Description |
---|---|
x | Specifies the value to be computed. |
Upon successful completion, the cosf, cosl, cos, cosd32, cosd64, and cosd128 subroutines return the cosine of x.
If x is NaN, a NaN is returned.
If x is ±0, the value 1.0 is returned.
If x is ±Inf, a domain error occurs, and a NaN is returned.