Article View: comp.arch
Article #11152Re: integer distance or sqrt
From: John Cleary
Date: Wed, 18 Nov 1992 03:23
Date: Wed, 18 Nov 1992 03:23
22 lines
1510 bytes
1510 bytes
>bbs.dennis@tsoft.sf-bay.org (Dennis Yelle) writes: >> I first considered asking for a integer sqrt, but maybe if the context is >> known a better answer can be given. This program is normally run on a >> machine with no floating point hardware so I would like to get rid of >> floats entirely. > >I sent him an integer square root code using Newton's Method. I've done >this problem before and I'm sure there are better methods out there. Does >somebody want to post/email something better than Newton's? > >Thanx, >Cliff Here at Calgary some years ago Geoff Wyvill greatly spedup the 'C" sqrt function on a Sun/3 by doing a table lookup on the high-order 16(approx) bits and then doing a single Newtons step. This ran roughly 10 times faster than the standard one (less code too!!). I presume that a similar trick would work in this case. -- John Cleary University of Calgary. cleary@cpsc.ucalgary.ca
Technical Details
Message-ID:
<Bxw6qM.Msw@cpsc.ucalgary.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!sun-barr!olivea!spool.mu.edu!yale.edu!yale!gumby!destroyer!cs.ubc.ca!unixg.ubc.ca!kakwa.ucs.ualberta.ca!acs.ucalgary.ca!cpsc.ucalgary.ca!clearyReferences:
<55F0TB1w165w@tsoft.sf-bay.org> <CLIFFC.92Nov15184340@miranda.rice.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!olivea!spool.mu.edu!yale.edu!yale!gumby!destroyer!cs.ubc.ca!unixg.ubc.ca!kakwa.ucs.ualberta.ca!acs.ucalgary.ca!cpsc.ucalgary.ca!cleary From: cleary@cpsc.ucalgary.ca (John Cleary) Newsgroups: comp.arch Subject: Re: integer distance or sqrt Summary: using table look-up helps Message-ID: <Bxw6qM.Msw@cpsc.ucalgary.ca> Date: 18 Nov 92 03:23:10 GMT References: <55F0TB1w165w@tsoft.sf-bay.org> <CLIFFC.92Nov15184340@miranda.rice.edu> Sender: news@cpsc.ucalgary.ca (News Manager) Organization: University of Calgary Computer Science Lines: 22