trig(S) 6 January 1993 trig(S) Name trig: acos, asin, atan, atan2, cos, sin, tan - trigonometric functions Syntax cc . . . -lm #include <math.h> double acos (x) double x; double asin (x) double x; double atan (x) double x; double atan2 (y, x) double y, x; double cos (x) double x; double sin (x) double x; double tan (x) double x; Description The acos routine computes the arc cosine of x in the range of [0, PI] radians. Specify x in the range of -1 to 1. Zero is returned on unsuc- cessful completion and errno indicates the error, or NaN (not a number) is returned and errno may be set to indicate the error. (NaN is defined in /usr/include/nan.h and is detected with the isnan(S) routine.) The asin routine returns the arc sine of x in the range of [-PI/2, PI/2] radians. Specify x in range of -1 to 1. Zero is returned on unsuccessful completion and errno indicates the error, or NaN is returned and errno may indicate the error. The atan routine returns the arc tangent of x in the range [-PI/2, PI/2] radians. Otherwise errno indicates the error or NaN is returned. The atan2 routine returns the arc tangent of y/x in the range of (-PI, PI]. Zero is returned on unsuccessful completion with errno indi- cating the error, or NaN is returned and errno may indicate the error. The cos routine returns the cosine of x measured in radians on successful completion. Otherwise, errno is set to indicate the error or NaN is returned. The cos routine may lose accuracy when its argument is far from zero. The sin routine returns the sine of its argument x measured in radians upon successful completion. Otherwise, errno is set to indicate the error or NaN is returned. The sin routine may lose accuracy when its argument is far from zero. When the sin routine fails, errno is set to one of: [EDOM] The value of x is NaN, or x is +-HUGEVAL. [ERANGE] The magnitude of x is such that total or partial loss of sig- nificance resulted. The tan routine returns the tangent of x measured in radians on success- ful completion. Otherwise, errno indicates the error or NaN is returned. The tan routine may lose accuracy when its argument is far from zero. The tan routine may fail if: [EDOM] The value of x is NaN. [ERANGE] The value to be returned would have caused overflow or under- flow, or the magnitude of x is such that total or partial loss of signal would result. Note Before checking for errors, set errno to zero. If a value appears in errno or if the routine returns NaN, an error occurred. Diagnostics sin, cos, and tan 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 a mes- sage 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, a message indicating DOMAIN error is printed on the standard error output. These error-handling procedures may be changed with the function matherr(S). See also matherr(S) Standards conformance acos, asin, atan, atan2, cos, sin, and tan AT&T SVID Issue 2; X/Open Portability Guide, Issue 3, 1989; ANSI X3.159-1989 Programming Language -- C; IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1); and NIST FIPS 151-1.