1SIN(3P)                    POSIX Programmer's Manual                   SIN(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       sin, sinf, sinl — sine function
13

SYNOPSIS

15       #include <math.h>
16
17       double sin(double x);
18       float sinf(float x);
19       long double sinl(long double x);
20

DESCRIPTION

22       The functionality described on this reference page is aligned with  the
23       ISO C  standard.  Any  conflict between the requirements described here
24       and the ISO C standard is unintentional. This  volume  of  POSIX.1‐2017
25       defers to the ISO C standard.
26
27       These functions shall compute the sine of their argument x, measured in
28       radians.
29
30       An application wishing to check for error situations should  set  errno
31       to  zero  and  call  feclearexcept(FE_ALL_EXCEPT)  before calling these
32       functions. On return, if errno is non-zero or fetestexcept(FE_INVALID |
33       FE_DIVBYZERO  |  FE_OVERFLOW  | FE_UNDERFLOW) is non-zero, an error has
34       occurred.
35

RETURN VALUE

37       Upon successful completion, these functions shall return the sine of x.
38
39       If x is NaN, a NaN shall be returned.
40
41       If x is ±0, x shall be returned.
42
43       If x is subnormal, a range error may occur
44       and x should be returned.
45
46       If x is not returned, sin(), sinf(), and sinl() shall return an  imple‐
47       mentation-defined  value no greater in magnitude than DBL_MIN, FLT_MIN,
48       and LDBL_MIN, respectively.
49
50       If x is ±Inf, a domain error shall occur, and a NaN shall be returned.
51

ERRORS

53       These functions shall fail if:
54
55       Domain Error
56                   The x argument is ±Inf.
57
58                   If the integer expression (math_errhandling  &  MATH_ERRNO)
59                   is  non-zero,  then  errno  shall be set to [EDOM].  If the
60                   integer expression (math_errhandling &  MATH_ERREXCEPT)  is
61                   non-zero,  then  the invalid floating-point exception shall
62                   be raised.
63
64       These functions may fail if:
65
66       Range Error The value of x is subnormal
67
68                   If the integer expression (math_errhandling  &  MATH_ERRNO)
69                   is  non-zero,  then errno shall be set to [ERANGE].  If the
70                   integer expression (math_errhandling &  MATH_ERREXCEPT)  is
71                   non-zero, then the underflow floating-point exception shall
72                   be raised.
73
74       The following sections are informative.
75

EXAMPLES

77   Taking the Sine of a 45-Degree Angle
78           #include <math.h>
79           ...
80           double radians = 45.0 * M_PI / 180;
81           double result;
82           ...
83           result = sin(radians);
84

APPLICATION USAGE

86       These functions may lose accuracy when their argument is near a  multi‐
87       ple of π or is far from 0.0.
88
89       On   error,   the   expressions  (math_errhandling  &  MATH_ERRNO)  and
90       (math_errhandling & MATH_ERREXCEPT) are independent of each other,  but
91       at least one of them must be non-zero.
92

RATIONALE

94       None.
95

FUTURE DIRECTIONS

97       None.
98

SEE ALSO

100       asin(), feclearexcept(), fetestexcept(), isnan()
101
102       The Base Definitions volume of POSIX.1‐2017, Section 4.20, Treatment of
103       Error Conditions for Mathematical Functions, <math.h>
104
106       Portions of this text are reprinted and reproduced in  electronic  form
107       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
108       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
109       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
110       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
111       event of any discrepancy between this version and the original IEEE and
112       The Open Group Standard, the original IEEE and The Open Group  Standard
113       is  the  referee document. The original Standard can be obtained online
114       at http://www.opengroup.org/unix/online.html .
115
116       Any typographical or formatting errors that appear  in  this  page  are
117       most likely to have been introduced during the conversion of the source
118       files to man page format. To report such errors,  see  https://www.ker
119       nel.org/doc/man-pages/reporting_bugs.html .
120
121
122
123IEEE/The Open Group                  2017                              SIN(3P)
Impressum