The Open Group Base Specifications Issue 7
IEEE Std 1003.1-2008
Copyright © 2001-2008 The IEEE and The Open Group

#### NAME

sin, sinf, sinl - sine function

#### SYNOPSIS

```#include <math.h> double sin(double x); float sinf(float x); long double sinl(long double x); ```

#### DESCRIPTION

[CX] The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of POSIX.1-2008 defers to the ISO C standard. These functions shall compute the sine of their argument x, measured in radians.

An application wishing to check for error situations should set errno to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these functions. On return, if errno is non-zero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has occurred.

#### RETURN VALUE

Upon successful completion, these functions shall return the sine of x.

[MX] If x is NaN, a NaN shall be returned.

If x is ±0, x shall be returned.

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

If x is ±Inf, a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned. #### ERRORS

These functions shall fail if:

Domain Error
[MX] The x argument is ±Inf.

If the integer expression (math_errhandling & MATH_ERRNO) is non-zero, then errno shall be set to [EDOM]. If the integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, then the invalid floating-point exception shall be raised. These functions may fail if:

Range Error
[MX] The value of x is subnormal

If the integer expression (math_errhandling & MATH_ERRNO) is non-zero, then errno shall be set to [ERANGE]. If the integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, then the underflow floating-point exception shall be raised. The following sections are informative.

#### EXAMPLES

##### Taking the Sine of a 45-Degree Angle
```#include <math.h>
...
double radians = 45.0 * M_PI / 180;
double result;
...

```

#### APPLICATION USAGE

These functions may lose accuracy when their argument is near a multiple of or is far from 0.0.

On error, the expressions (math_errhandling & MATH_ERRNO) and (math_errhandling & MATH_ERREXCEPT) are independent of each other, but at least one of them must be non-zero.

None.

None.

#### CHANGE HISTORY

First released in Issue 1. Derived from Issue 1 of the SVID.

#### Issue 5

The last two paragraphs of the DESCRIPTION were included as APPLICATION USAGE notes in previous issues.

#### Issue 6

The sinf() and sinl() functions are added for alignment with the ISO/IEC 9899:1999 standard.

The DESCRIPTION, RETURN VALUE, ERRORS, and APPLICATION USAGE sections are revised to align with the ISO/IEC 9899:1999 standard.

IEC 60559:1989 standard floating-point extensions over the ISO/IEC 9899:1999 standard are marked.

End of informative text.
{"ft_lang_label":"__label__en","ft_lang_prob":0.79298234,"math_prob":0.78246737,"size":2761,"snap":"2022-40-2023-06","text_gpt3_token_len":679,"char_repetition_ratio":0.1164309,"word_repetition_ratio":0.10440835,"special_character_ratio":0.24121696,"punctuation_ratio":0.14450867,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9791256,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,7,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-10-06T09:55:22Z\",\"WARC-Record-ID\":\"<urn:uuid:9da9cad7-f285-4e19-9f98-481c88cc1f12>\",\"Content-Length\":\"8674\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:41020146-4602-4f6f-86fc-bd09b6562f0a>\",\"WARC-Concurrent-To\":\"<urn:uuid:c690ed46-d5c1-4be1-9ae1-d760f931c1bd>\",\"WARC-IP-Address\":\"52.54.203.87\",\"WARC-Target-URI\":\"https://pubs.opengroup.org/onlinepubs/9699919799.2008edition/functions/sin.html\",\"WARC-Payload-Digest\":\"sha1:R3OFGFPG2LMUUJMANKKVOACUDWXCQBMR\",\"WARC-Block-Digest\":\"sha1:D6MJTAJ5NXR4ZEWJOQS3MPE7A357DM6C\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-40/CC-MAIN-2022-40_segments_1664030337803.86_warc_CC-MAIN-20221006092601-20221006122601-00269.warc.gz\"}"}