delorie.com/djgpp/doc/libc/libc_728.html | search |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
#include <math.h> double sin(double x); |
This function computes the sine of x (which should be given in radians).
The sine of x. If the absolute value of x is finite but
greater than or equal to 2^63, the value is 0 (since for
arguments that large each bit of the mantissa is more than Pi
).
If the value of x is infinite or NaN
, the return value is
NaN
and errno
is set to EDOM
.
ANSI/ISO C | C89; C99 |
POSIX | 1003.2-1992; 1003.1-2001 |
In general, this function's relative accuracy is about
1.7*10^(-16), which is close to the machine precision for a
double
. However, for arguments very close to Pi
and its
odd multiples, the relative accuracy can be many times worse, due to
loss of precision in the internal FPU computations. Since
sin(Pi) is zero, the absolute accuracy is still very good; but if
your program needs to preserve high relative accuracy for such
arguments, link with `-lm' and use the version of sin
from
`libm.a' which does elaborate argument reduction, but is about
three times slower.
webmaster | delorie software privacy |
Copyright © 2004 | Updated Apr 2004 |