/* Integer square root */
/* © Copyright 1999 by John Halleck, All Rights Reserved */
/* This is a stupid way to do square root, but it is portable */
long isqrt (x) long x; {
long s; long remainder;
if (x<=0) return 0;
remainder = x; s = 1;
while ( remainder >= s ) {
remainder -= s;
s += 2;
}
return (s-1)>>1;
}
Go to ...
This page is http://www.cc.utah.edu/~nahaj/factoring/isqrt.definition.c.html
© Copyright 2003 by John Halleck, All Rights Reserved.
This snapshot was last modified on January 12th, 2009
And the underlying file was last modified on December 12th, 2005