File:  [MW Coherent from dump] / coherent / b / lib / libm / log10.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:35 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

/*
 * Evaluate the logarithm (base 10) function.
 * (Hart 2355, 19.74)
 */
#include <math.h>

#if	EMU87
#include "emumath.h"
#endif

static readonly double logntab[] ={
	-0.1042911213725266949744122e+02,
	 0.1344458152275036223645300e+02,
	-0.4185596001312662063300000e+01,
	 0.1828759212091999337000000e+00
};
static readonly double logmtab[] ={
	-0.1200695907020063424342180e+02,
	 0.1948096618798093652415500e+02,
	-0.8911109060902708565400000e+01,
	 0.1000000000000000000000000e+01
};

double
log10(x)
double x;
{
	double r, z;
	int n;

	if (x <= 0.0) {
		errno = EDOM;
		return (0.0);
	}
	if (x == 1.)
		return(0.);
	x = frexp(x, &n);
	x *= SQRT2;
	z = (x-1.0)/(x+1.0);
	r = z*z;
	r = z*(_pol(r, logntab, 4)/_pol(r, logmtab, 4));
	r += (n-0.5)*LOG2B10;
	return (r);
}

unix.superglobalmegacorp.com

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