Integer square root routine needed.

Todd M. Lewis utoddl at ecsvax.UUCP
Mon Jul 31 23:28:11 AEST 1989


This may be the wrong place to post this, but I need C source
to a reasonably fast integer square root routine.  (Actually
a clear description of an efficient algorithm would do--I can
write the code myself.)

The wheel I'm inventing is a library of matrix operations for
3-D graphics for Yet Another Ultimate Space Game.  I've got 
everything working with longs, but there's this one place where
I just can't seem to get around doing a square root.  Right now
I'm converting to a double and back, and that works Ok, but
I'd rather have no floating point operations.

So, How does one efficiently go about taking the square root
of a long?

Thanks,

Todd M. Lewis, utoddl at ecsvax.uncecs.edu, utoddl at ecsvax.bitnet
  To quote Eugene H. Spafford, "Crisis and Aftermath", Communications of
  the ACM, vol. 32, no. 6, (June 1989), p. 684:
  "It is curious that this many people [...] would assume to know the
   intent of the author based on the observed behavior of the program."



More information about the Comp.lang.c mailing list