Annotation of coherent/b/lib/libm/log10.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Evaluate the logarithm (base 10) function.
                      3:  * (Hart 2355, 19.74)
                      4:  */
                      5: #include <math.h>
                      6: 
                      7: #if    EMU87
                      8: #include "emumath.h"
                      9: #endif
                     10: 
                     11: static readonly double logntab[] ={
                     12:        -0.1042911213725266949744122e+02,
                     13:         0.1344458152275036223645300e+02,
                     14:        -0.4185596001312662063300000e+01,
                     15:         0.1828759212091999337000000e+00
                     16: };
                     17: static readonly double logmtab[] ={
                     18:        -0.1200695907020063424342180e+02,
                     19:         0.1948096618798093652415500e+02,
                     20:        -0.8911109060902708565400000e+01,
                     21:         0.1000000000000000000000000e+01
                     22: };
                     23: 
                     24: double
                     25: log10(x)
                     26: double x;
                     27: {
                     28:        double r, z;
                     29:        int n;
                     30: 
                     31:        if (x <= 0.0) {
                     32:                errno = EDOM;
                     33:                return (0.0);
                     34:        }
                     35:        if (x == 1.)
                     36:                return(0.);
                     37:        x = frexp(x, &n);
                     38:        x *= SQRT2;
                     39:        z = (x-1.0)/(x+1.0);
                     40:        r = z*z;
                     41:        r = z*(_pol(r, logntab, 4)/_pol(r, logmtab, 4));
                     42:        r += (n-0.5)*LOG2B10;
                     43:        return (r);
                     44: }

unix.superglobalmegacorp.com

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