预订演示
前页 后页

sin

Circular sine.

SYNOPSIS:

double x, y, sin();
y = sin(x);

DESCRIPTION:
Range reduction is into intervals of pi/4.  The reduction error is nearly eliminated by contriving an extended precision modular arithmetic.

Two polynomial approximating functions are employed.
Between 0 and pi/4 the sine is approximated by:

      x  +  x**3 P(x**2).

Between pi/4 and pi/2 the cosine is represented as:
      1  -  x**2 Q(x**2).

ACCURACY:
                      Relative error:
arithmetic   domain      # trials      peak         rms
    DEC       0, 10       150000       3.0e-17     7.8e-18
    IEEE -1.07e9,+1.07e9  130000       2.1e-16     5.4e-17

ERROR MESSAGES:

  message        condition        value returned
  total loss    x > 1.073741824e9      0.0

Partial loss of accuracy begins to occur at x = 2**30 = 1.074e9.  The loss is not gradual, but jumps suddenly to about 1 part in 10e7.  Results might be meaningless for x > 2**49 = 5.6e14.  The routine as implemented flags a TLOSS error for x > 2**30 and returns 0.0.