From 7ce331c01ce6eb7b3f5c715a38a24359da9c6ee2 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 22 Nov 2001 14:04:29 +0000 Subject: Totally rework the math library, this time based on the MacOs X math library (which is itself based on the math lib from FreeBSD). -Erik --- libm/double/lsqrt.c | 85 ----------------------------------------------------- 1 file changed, 85 deletions(-) delete mode 100644 libm/double/lsqrt.c (limited to 'libm/double/lsqrt.c') diff --git a/libm/double/lsqrt.c b/libm/double/lsqrt.c deleted file mode 100644 index bf85a54f1..000000000 --- a/libm/double/lsqrt.c +++ /dev/null @@ -1,85 +0,0 @@ -/* lsqrt.c - * - * Integer square root - * - * - * - * SYNOPSIS: - * - * long x, y; - * long lsqrt(); - * - * y = lsqrt( x ); - * - * - * - * DESCRIPTION: - * - * Returns a long integer square root of the long integer - * argument. The computation is by binary long division. - * - * The largest possible result is lsqrt(2,147,483,647) - * = 46341. - * - * If x < 0, the square root of |x| is returned, and an - * error message is printed. - * - * - * ACCURACY: - * - * An extra, roundoff, bit is computed; hence the result - * is the nearest integer to the actual square root. - * NOTE: only DEC arithmetic is currently supported. - * - */ - -/* -Cephes Math Library Release 2.0: April, 1987 -Copyright 1984, 1987 by Stephen L. Moshier -Direct inquiries to 30 Frost Street, Cambridge, MA 02140 -*/ - -#include - -long lsqrt(x) -long x; -{ -long num, sq; -long temp; -int i, j, k, n; - -if( x < 0 ) - { - mtherr( "lsqrt", DOMAIN ); - x = -x; - } - -num = 0; -sq = 0; -k = 24; -n = 4; - -for( j=0; j<4; j++ ) - { - num |= (x >> k) & 0xff; /* bring in next byte of arg */ - if( j == 3 ) /* do roundoff bit at end */ - n = 5; - for( i=0; i= 0 ) - { - num = temp; /* it went in */ - sq += 256; /* answer bit = 1 */ - } - } - k -= 8; /* shift count to get next byte of arg */ - } - -sq += 256; /* add roundoff bit */ -sq >>= 9; /* truncate */ -return( sq ); -} -- cgit v1.2.3