TRIG(3M) SysV TRIG(3M)
NAME
trig: sin, cos, tan, asin, acos, atan, atan2 - trigonometric functions
SYNOPSIS
#include <math.h>
double sin (x)
double x;
double cos (x)
double x;
double tan (x)
double x;
double asin (x)
double x;
double acos (x)
double x;
double atan (x)
double x;
double atan2 (y, x)
double y, x;
DESCRIPTION
sin, cos and tan return respectively the sine, cosine and tangent of
their argument, x, measured in radians.
asin returns the arcsine of x, in the range [-pi/2,pi/2].
acos returns the arccosine of x, in the range [0,pi].
atan returns the arctangent of x, in the range [-pi/2,pi/2].
atan2 returns the arctangent of y/x, in the range (-pi,pi], using the
signs of both arguments to determine the quadrant of the return value.
SEE ALSO
matherr(3M).
DIAGNOSTICS
For sin, cos, and tan, if x is NaN, either errno is set to indicate the
error or NaN is returned.
These functions lose accuracy when their argument is far from zero. For
arguments sufficiently large, these functions return zero when there
would otherwise be a complete loss of significance. In this case, and
only if you have linked your program to /usr/lib/crt0.o, a message
indicating TLOSS error is printed on the standard error output. For less
extreme arguments causing partial loss of significance, a PLOSS error is
generated but no message is printed. In both cases, errno is set to
ERANGE.
If the magnitude of the argument of asin or acos is greater than one, or
if both arguments of atan2 are zero, zero is returned and errno is set to
EDOM.
In addition, if you have linked your program to /usr/lib/crt0.o, a
message indicating DOMAIN error is printed on the standard error output.
For atan, if x is NaN, NaN is returned. Otherwise, either errno is set
to indicate the error or NaN is returned.
These error-handling procedures may be changed with the function
matherr(3M).
ERRORS
sin, cos, or tan fails if the following is true:
[ERANGE] The magnitude of x is such that total or partial loss of
significance resulted.
asin, and acos, fail if the following is true:
[EDOM] The x parameter is not in the domain [-1,1].
atan2 fails if the following is true:
[EDOM] Both arguments are zero or one of the arguments is NaN.