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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Fun with Unbounded Rational Numbers Date: Mon, 10 Apr 2017 19:08:22 +0200 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <87zifq831u.fsf@nightsong.com> <87mvbp8el4.fsf@nightsong.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 10 Apr 2017 17:05:18 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="8af9938be2f854ed69ca5489fadad29a"; logging-data="17191"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+4bzhYVoaMYnQaUAtD3qJ0otWt9an5lC0=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: <87mvbp8el4.fsf@nightsong.com> Cancel-Lock: sha1:dH+eSmz4OJ7Ml6FLVttocKmwqJk= Xref: news.eternal-september.org comp.lang.ada:46563 Date: 2017-04-10T19:08:22+02:00 List-Id: On 04/09/2017 11:18 PM, Paul Rubin wrote: > "Jeffrey R. Carter" writes: >> The implementation is >> >> X := R / Two; >> All_Iterations : for I in 1 .. 15 loop >> Y := X ** 2 - R; >> exit All_Iterations when abs Y < A; ... > > > Can you instrument this loop to check how many iterations are actually > being executed, and preferably how long each one takes? As I said in another post, the thing that was taking the time was subtracting R (2) in the calculation of Y. I made some improvements to the addition algorithm and now it calculates sqrt(2) to within 0.000001 very quickly, in 4-5 iterations. The result is 665857/470832. -- Jeff Carter "I didn't squawk about the steak, dear. I merely said I didn't see that old horse that used to be tethered outside here." Never Give a Sucker an Even Break 103