Include:
Prototype: double cos(double x);
double sin(double x);
double tan(double x);
Returns: (cos) the cosine of x if successful, or 0 if not
(sin) the sine of x if successful, or 0 if not
(tan) the tangent of x if successful, or 0 if not
See also: acos, asin, atan, atan2, matherr, sinh, tanh
The acos, asin, atan, and atan2 functions return the arccosine, the
arcsine and the arctangent values of x respectively. The argument x is
specified in radians. The atan2 function uses the signs of both arguments
to determine the quadrant of the return value. The functions, argument
range and return value range are listed below:
Function Argument Range Return Value Range
acos -1 to 1 0 to ã
asin -1 to 1 -ã/2 to ã/2
atan no limit -ã/2 to ã/2
atan2 no limit -ã to ã
Return Value
The return values for these functions are described above.
For the acos and asin functions, x must be between -1 and 1. If x is less
than -1 or greater than 1, acos and asin set errno to EDOM, print a DOMAIN
error message to stderr, and return 0.
If both arguments to atan2 are 0, the function sets errno to EDOM, prints
a DOMAIN error message to stderr, and returns 0.
Error handling can be modified with the matherr routine.
The cos, sin, and tan trigonometric functions return the cosine, sine and
tangent respectively, of x.
Return Value
If x is large, a partial loss of significance in the result may occur in a
trigonometric function, in which case the function generates a PLOSS
error. If x is so large that significance is completely lost, the function
prints a TLOSS message to stderr and returns 0. In both cases, errno is
set to ERANGE.