[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 2

sin, sinl, cos, cosl, tan, or tanl Subroutine

Purpose

Computes the trigonometric functions.

Libraries

IEEE Math Library (libm.a)

or System V Math Library (libmsaa.a)

Syntax

#include <math.h>
double sin (x)
double x;
long double sinl (x)
long double x;
double cos (x)
double x;
long double cosl (x)
long double x;
double tan (x)
double x;
long double tanl (x)
long double x;

Description

The sin, cos, and tan subroutines return the sine, cosine, and tangent, respectively, of their parameters, which are in radians. The sinl subroutine, cosl subroutine, and tanl subroutine return the same values, but these subroutines take and return numbers of the long double data type.

Parameters

x Specifies some double-precision floating-point value. For the sinl, cosl, and tanl subroutines, specifies a long double-precision floating-point value.
y Specifies some double-precision floating-point value. For the sinl subroutine, cosl subroutine, and tanl subroutine, specifies a long double-precision floating-point value.

Error Codes

The sin, sinl, cos, cosl, tan, and tanl subroutines lose accuracy when passed a large value for the x parameter. In the sin subroutine, for example, values of x that are greater than pi are argument-reduced by first dividing them by the machine value for 2 * pi , and then using the IEEE remainder of this division in place of x. Since the machine value of pi can only approximate its infinitely precise value, the remainder of x/(2 * pi) becomes less accurate as x becomes larger. Similar loss of accuracy occurs for the sinl, cos, cosl, tan, and tanl subroutines during argument reduction of large arguments.

sin, cos, When the x parameter is extremely large, these functions return 0 when there would be a complete loss of significance. In this case, a message indicating TLOSS error is printed on the standard error output. For less extreme values causing partial loss of significance, a PLOSS error is generated but no message is printed. In both cases, the errno global variable is set to a ERANGE value.

These error-handling procedures may be changed with the matherr subroutine when using the libmsaa.a (-lmsaa) library.

Implementation Specifics

These subroutines are part of Base Operating System (BOS) Runtime.

Related Information

The matherr subroutine, sinh, sinhl, cosh, coshl, tanh, or tanhl subroutines.

Subroutines Overview in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.

128-Bit long double Floating-Point Format in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Contents | Glossary | Home | Search ]