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

⟦be0b0c1b7⟧ TextFile

    Length: 213 (0xd5)
    Types: TextFile
    Notes: UNIX file
    Names: »tanh.c«

Derivation

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

TextFile

/*
 * Hyperbolic tangent.
 */
#include <math.h>

double
tanh(x)
double x;
{
	double r;
	register int s;

	s = 0;
	if (x < 0.0) {
		x = -x;
		s = 1;
	}
	r = exp(-2.0*x);
	r = (1.0-r) / (1.0+r);
	return (s?-r:r);
}