delorie.com/djgpp/doc/libc/libc_728.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

sin

Syntax

 
#include <math.h>

double sin(double x);

Description

This function computes the sine of x (which should be given in radians).

Return Value

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.

Portability

ANSI/ISO C C89; C99
POSIX 1003.2-1992; 1003.1-2001

Accuracy

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