trig(3M) DG/UX R4.11MU05 trig(3M)
NAME
trig: sin, sinf, cos, cosf, tan, tanf, asin, asinf, acos, acosf,
atan, atanf, atan2, atan2f - trigonometric functions
SYNOPSIS
cc [flag ...] file ... -lm [library ...]
#include <math.h>
double sin (double x);
float sinf (float x);
double cos (double x);
float cosf (float x);
double tan (double x);
float tanf (float x);
double asin (double x);
float asinf (float x);
double acos (double x);
float acosf (float x);
double atan (double x);
float atanf (float x);
double atan2 (double y, double x);
float atan2f (float y, float x);
DESCRIPTION
sin, cos, and tan and the single-precision versions sinf, cosf, and
tanf return, respectively, the sine, cosine, and tangent of their
argument, x, measured in radians.
In the following paragraphs, pi represents pi.
asin and asinf return the arcsine of x, in the range [-pi/2,+pi/2].
acos and acosf return the arccosine of x, in the range [0,+pi].
atan and atanf return the arctangent of x, in the range
(-pi/2,+pi/2).
atan2 and atan2f return the arctangent of y/x, in the range
(-pi,+pi], using the signs of both arguments to determine the
quadrant of the return value.
Those functions using float arguments, sinf, cosf, tanf, asinf,
acosf, atanf, and atan2f, will give unpredictable results when used
with the -Xt compilation option. In traditional compilation mode
float arguments are promoted to doubles. An object compiled with -Xt
will expect this promotion and therefore not work correctly with
these functions.
Considerations for Threads Programming
+---------+-----------------------------+
| | async- |
|function | reentrant cancel cancel |
| | point safe |
+---------+-----------------------------+
|acos | Y N N |
|acosf | Y N N |
|asin | Y N N |
|asinf | Y N N |
|atan | Y N N |
|atan2 | Y N N |
|atan2f | Y N N |
|atanf | Y N N |
|cos | Y N N |
|cosf | Y N N |
|sin | Y N N |
|sinf | Y N N |
|tan | Y N N |
|tanf | Y N N |
+---------+-----------------------------+
DIAGNOSTICS
When the -Xt compilation option is used, if the magnitude of the
argument of asin, asinf, acos, or acosf is greater than 1, or if both
arguments of atan2 or atan2f are 0, 0 is returned and errno is set to
EDOM. In addition, a message indicating DOMAIN error is printed on
the standard error output.
When the -Xa or -Xc compilation options are used, if the magnitude of
the argument of asin, asinf, acos, or acosf is greater than 1, then
IEEE NaN is returned, errno is set to EDOM, and an invalid operation
exception is raised.
For each of these functions, if any argument is a quiet NaN, that
value is returned. If any argument is a signaling NaN, a quiet NaN
is returned and an invalid operation exception is raised. In either
case, errno is set to EDOM, and a message indicating DOMAIN error is
printed on the standard error output.
If the argument to sin, sinf, cos, cosf, tan or tanf is ±oo, then
IEEE NaN is returned, an invalid operation exception is raised, and
errno is set to EDOM. In addition, a message indicating DOMAIN error
is printed on the standard error output.
When the -Xt compilation option is used, these error-handling
procedures may be changed with the function matherr. When the -Xa or
-Xc compilation options are used, no error messages are printed.
SEE ALSO
cc(1). reentrant(3), matherr(3M), fpsetmask(3C).
Licensed material--property of copyright holder(s)