SIN(3m,L) AIX Technical Reference SIN(3m,L)
-------------------------------------------------------------------------------
sin, cos, tan, asin, acos, atan, atan2
PURPOSE
Computes trigonometric functions.
LIBRARY
Math Library (libm.a)
SYNTAX
#include
double sin (x) double asin (x)
double x; double x;
double cos (x) double acos (x)
double x; double x;
double tan (x) double atan (x)
double x; double x;
double atan2 (y, x)
double x, y;
DESCRIPTION
The sin, cos, and tan subroutines return the sine, cosine and tangent,
respectively, of their parameters, which are in radians.
The asin subroutine returns the arcsine of x, in the range -pi/2 to pi/2.
The acos subroutine returns the arccosine of x, in the range 0 to pi.
The atan subroutine returns the arctangent of x, in the range -pi/2 to pi/2.
The atan2 subroutine returns the arctangent of y/x, in the range -pi to pi,
using the signs of both parameters to determine the quadrant of the return
value.
ERROR CONDITIONS
These subroutines can perform either of the following types of error handling.
Both types of error handling allows you to define special actions to be taken
when an error occurs.
Processed November 7, 1990 SIN(3m,L) 1
SIN(3m,L) AIX Technical Reference SIN(3m,L)
o On the PS/2 only, exception handling is performed by default according to
ANSI/IEEE standard 754 for binary floating-point arithmetic for arguments x
in the range between -2(63) and 2(63). Otherwise, the behavior of these
subroutines is undefined.
If a hardware floating point processor is installed in your system, then
using this option can provide greater performance in addition to IEEE
exception handling. This mode instructs the C compiler to generate code
that avoids the overhead of the math library subroutines by generating math
coprocessor code in-line.
o On the AIX/370, matherr error handling is performed by default (see matherr
handling, as described on page matherr-1). To activate matherr error
handling on the PS/2, include the -z option on the cc command line when
compiling source code. The default error-handling procedures for these
subroutines are as follows:
sin, cos, tan
The sin, cos and tan subroutines lose accuracy when passed a large value
for the x parameter. For sufficiently large parameters, these functions
return 0 when there would otherwise be a complete loss of significance.
In this case, a message that indicates a TLOSS error is written to
standard error. For less extreme values, a PLOSS error is generated but
no message is written. In both cases, errno is set to ERANGE.
The tan subroutine can return +/-HUGE if its parameter is near an odd
multiple of pi/2 when the correct value would overflow, and sets errno
to ERANGE.
asin, acos
The asin and acos subroutines return 0 and set errno to EDOM if their
parameters are larger than 1.0. In addition, an error message that
indicates a domain error is written to the standard error output.
RELATED INFORMATION
In this book: "matherr."
Processed November 7, 1990 SIN(3m,L) 2