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

NAME

6       sin, sinf, sinl - sine function
7

SYNOPSIS

9       #include <math.h>
10
11       double sin(double x);
12       float sinf(float x);
13       long double sinl(long double x);
14
15

DESCRIPTION

17       These functions shall compute the sine of their argument x, measured in
18       radians.
19
20       An application wishing to check for error situations should  set  errno
21       to  zero  and  call  feclearexcept(FE_ALL_EXCEPT)  before calling these
22       functions.  On return, if errno is non-zero or  fetestexcept(FE_INVALID
23       |  FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has
24       occurred.
25

RETURN VALUE

27       Upon successful completion, these functions shall return the sine of x.
28
29       If x is NaN, a NaN shall be returned.
30
31       If x is ±0, x shall be returned.
32
33       If x is subnormal, a range error may occur and x should be returned.
34
35       If x is ±Inf, a domain error shall occur, and either  a  NaN  (if  sup‐
36       ported), or an implementation-defined value shall be returned.
37

ERRORS

39       These functions shall fail if:
40
41       Domain Error
42              The x argument is ±Inf.
43
44       If  the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
45       then  errno  shall  be  set  to  [EDOM].  If  the  integer   expression
46       (math_errhandling  &  MATH_ERREXCEPT)  is  non-zero,  then  the invalid
47       floating-point exception shall be raised.
48
49
50       These functions may fail if:
51
52       Range Error
53              The value of x is subnormal
54
55       If the integer expression (math_errhandling & MATH_ERRNO) is  non-zero,
56       then  errno  shall  be  set  to  [ERANGE].  If  the  integer expression
57       (math_errhandling & MATH_ERREXCEPT) is  non-zero,  then  the  underflow
58       floating-point exception shall be raised.
59
60
61       The following sections are informative.
62

EXAMPLES

64   Taking the Sine of a 45-Degree Angle
65              #include <math.h>
66              ...
67              double radians = 45.0 * M_PI / 180;
68              double result;
69              ...
70              result = sin(radians);
71

APPLICATION USAGE

73       These  functions may lose accuracy when their argument is near a multi‐
74       ple of pi or is far from 0.0.
75
76       On  error,  the  expressions  (math_errhandling   &   MATH_ERRNO)   and
77       (math_errhandling  & MATH_ERREXCEPT) are independent of each other, but
78       at least one of them must be non-zero.
79

RATIONALE

81       None.
82

FUTURE DIRECTIONS

84       None.
85

SEE ALSO

87       asin() , feclearexcept() , fetestexcept() , isnan() , the Base  Defini‐
88       tions  volume of IEEE Std 1003.1-2001, Section 4.18, Treatment of Error
89       Conditions for Mathematical Functions, <math.h>
90
92       Portions of this text are reprinted and reproduced in  electronic  form
93       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
94       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
95       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
96       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
97       event of any discrepancy between this version and the original IEEE and
98       The Open Group Standard, the original IEEE and The Open Group  Standard
99       is  the  referee document. The original Standard can be obtained online
100       at http://www.opengroup.org/unix/online.html .
101
102
103
104IEEE/The Open Group                  2003                               SIN(P)
Impressum