๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #10942

Re: integer distance or sqrt

#10942
From: Olaf Rene Birkeland
Date: Mon, 16 Nov 1992 10:56
31 lines
2026 bytes
In article <CLIFFC.92Nov15184340@miranda.rice.edu>, cliffc@rice.edu (Cliff Click) writes:
|> bbs.dennis@tsoft.sf-bay.org (Dennis Yelle) writes:
|> > because of the interest in Herman Rubin's optimization problems
|> > some people here might be interested in this.
|> > It is a real problem.  That is, I have a program that spends quite a 
|> > lot of time here, and I would like to change this if I could.  
|> 
|> > 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?

I don't know the details of your algorithm, but wouldn't it be
possible to avoid sqrt's, i.e. do the substitutions

  sqrt(x^2 + y^2) < sqrt (z^2+t^2)    => (x^2+y^2) < (z^2+y^2)
  sqrt(x^2 + y^2) < d                 => (x^2+y^2) < d^2

and so on? This demands larger integers, but that might be needed
anyway for temporary calculations?

- Olaf Renรฉ 
 
--------------------------------------------------------------
Olaf Renรฉ Birkeland                 e-mail: renebi@idt.unit.no
The Norwegian Institute of Technology, University of Trondheim
--------------------------------------------------------------
Technical Details
Message-ID: <1992Nov16.105623.27220@ugle.unit.no>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!ugle.unit.no!sigyn.idt.unit.no!renebi
References: <55F0TB1w165w@tsoft.sf-bay.org> <CLIFFC.92Nov15184340@miranda.rice.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.arch
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!ugle.unit.no!sigyn.idt.unit.no!renebi
From: renebi@idt.unit.no (Olaf Rene Birkeland)
Subject: Re: integer distance or sqrt
Message-ID: <1992Nov16.105623.27220@ugle.unit.no>
Sender: news@ugle.unit.no (NetNews Administrator)
Reply-To: renebi@idt.unit.no
Organization: The Norwegian Institute of Technology
References: <55F0TB1w165w@tsoft.sf-bay.org> <CLIFFC.92Nov15184340@miranda.rice.edu>
Date: Mon, 16 Nov 92 10:56:23 GMT
Lines: 35