[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

# Technical Reference: Base Operating System and Extensions, Volume 2

## sin, sinf, or sinl Subroutine

### Purpose

Computes the sine.

### Syntax

`#include <math.h>`

double sin ( x)
double x;

```float sinf (x)
float x;
```

```long double sinl (x)
long double x;```

### Description

The sin, sinf, sinl subroutines compute the sine of the x parameter, measured in radians.

An application wishing to check for error situations should set the errno global variable to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these subroutines. Upon return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.

### Parameters

 x Floating-point value y Floating-point value

### Return Values

Upon successful completion, the sin, sinf, and sinl subroutines return the sine of x.

If x is NaN, a NaN is returned.

If x is ±0, x is returned.

If x is subnormal, a range error may occur and x should be returned.

If x is ±Inf, a domain error occurs, and a NaN is returned.

### Error Codes

The sin, sinf, and sinl 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 subroutine during argument reduction of large arguments.

 sin 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.

### Related Information

The matherr subroutine, sinh, sinhl (sinh, sinhf, or sinhl Subroutine) subroutines.

Subroutines Overview in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

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

math.h in AIX 5L Version 5.2 Files Reference.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]