DataMuseum.dk

Presents historical artifacts from the history of:

Commodore CBM-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Commodore CBM-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦d2e26a9f8⟧ TextFile

    Length: 688 (0x2b0)
    Types: TextFile
    Notes: UNIX file
    Names: »log10.c«

Derivation

└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
    └─⟦f4b8d8c84⟧ UNIX V7 Filesystem
        └─ ⟦this⟧ »libm/log10.c« 

TextFile

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

static double logntab[] ={
	-0.1042911213725266949744122e+02,
	 0.1344458152275036223645300e+02,
	-0.4185596001312662063300000e+01,
	 0.1828759212091999337000000e+00
};
static 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);
	}
	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);
}