Annotation of coherent/b/lib/libm/sin.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * libm/sin.c
        !             3:  * Evaluate the sine function.
        !             4:  */
        !             5: 
        !             6: #include <math.h>
        !             7: 
        !             8: #if    EMU87
        !             9: #include "emumath.h"
        !            10: #endif
        !            11: 
        !            12: #define        THRESHOLD       1.111111111111111111e-3
        !            13: 
        !            14: /*
        !            15:  * When |x| is very small, use the series
        !            16:  *     x - x**3 / 6 + x**5 / 120 - ...
        !            17:  * to get an accurate result while avoiding loss of precision.
        !            18:  * The THRESHOLD value above is determined empirically.
        !            19:  */
        !            20: static readonly double sintab[] ={
        !            21:         0.000000000000000000000000,
        !            22:         1.000000000000000000000000,
        !            23:         0.000000000000000000000000,
        !            24:        -0.166666666666666666666666,
        !            25:         0.000000000000000000000000,
        !            26:         0.008333333333333333333333
        !            27: };
        !            28: 
        !            29: double
        !            30: sin(x) double x;
        !            31: {
        !            32:        if (fabs(x) < THRESHOLD)
        !            33:                return _pol(x, sintab, 6);
        !            34:        return cos(PI/2.0 - x);
        !            35: }
        !            36: 
        !            37: /* end of sin.c */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.