From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fedc2d05e82c9174 X-Google-Attributes: gid103376,public From: "David C. Hoos, Sr." Subject: Re: Calculating SQRT in ADA Date: 1999/03/25 Message-ID: #1/1 X-Deja-AN: 459185509 Content-Transfer-Encoding: 7bit References: <7dbv6t$4u5$1@nnrp1.dejanews.com> <19990324201959.00800.00000708@ngol04.aol.com> <7dei9a$dvo$1@nnrp1.dejanews.com> Content-Type: text/plain; charset="iso-8859-1" X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-03-25T00:00:00+00:00 List-Id: Mark A Biggar wrote in message <36FAA3DF.42C31CF@lmco.com>... >Hans Marqvardsen wrote: >> >> John Herro wrote: > >No,no,no,no! > >This algorithm has quadratic convergence. This means that each time through the >loop doubles the number of correct bits in the answer. So with IEEE double >precession float you need loop at most 6 times, and even with extended float >7 times, so don't test against a torerance at all, just loop 6 or 7 times >and be done with it. > No,no,no,no! (to coin a phrase) The number of correct bits doubles with every iteration, only if you are counting place holding bits as well as mantissa bits. So, if you take the square root of 2.0e100, for example, 173 iterations are required if the argument is used as the initial estimate. similar number is required for 0.5e-100, but only six iterations are required for 2.0e00 or 0.5e00. This is why as Robert stated first, and I reiterated in my earlier post, the coice of the initial estimate is very important, if you're concerned about execution time. If the machine representation is known, an improved initial estimate can be made using the halving the exponent method I outlined in my earlier post.