|
|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 275 (0x113)
Types: TextFile
Notes: UNIX file
Names: »sqrt.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
└─⟦f4b8d8c84⟧ UNIX Filesystem
└─⟦this⟧ »libm/sqrt.c«
/*
* Square root function.
*/
#include <math.h>
double
sqrt(x)
double x;
{
double s;
int i;
register int n;
if (x < 0.0) {
errno = EDOM;
return (0.0);
}
n = L2L2P;
frexp(x, &i);
s = ldexp(1.0, i/2);
do {
s = (s + x/s) / 2.0;
} while (--n);
return (s);
}