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/26 Message-ID: #1/1 X-Deja-AN: 459296196 Content-Transfer-Encoding: 7bit References: <7dei54$dv2$1@nnrp1.dejanews.com> <19990325232830.01123.00000079@ngol02.aol.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-26T00:00:00+00:00 List-Id: John Herro wrote in message <19990325232830.01123.00000079@ngol02.aol.com>... >Robert Dewar said: >> The proper way for testing for convergence is to see if >> the new guess is the same as the last guess! > >Hans Marqvardsen said: >>> while X /= 0.0 and then >>> abs(Guess*Guess/X - 1.0) > 3.0*Dummy'Epsilon loop >> Where does the multiplier 3.0 come from? > >There are some cases where the loop will alternate between two guesses, so >testing that the new guess is the same as the last guess won't guarantee >convergence with every implementation. However, it might be possible to >terminate when the guess is the same as EITHER the last guess OR the >second-to-last guess. I can't prove to myself that the loop would always >terminate in this case, but it seems likely that it will. > John -- Did you look at my convergence test? It always works.