comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Fun with Unbounded Rational Numbers
Date: Mon, 10 Apr 2017 19:08:22 +0200
Date: 2017-04-10T19:08:22+02:00	[thread overview]
Message-ID: <ocge0e$gp7$1@dont-email.me> (raw)
In-Reply-To: <87mvbp8el4.fsf@nightsong.com>

On 04/09/2017 11:18 PM, Paul Rubin wrote:
> "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> 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


  reply	other threads:[~2017-04-10 17:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-08 10:37 Fun with Unbounded Rational Numbers Jeffrey R. Carter
2017-04-08 11:19 ` Dmitry A. Kazakov
2017-04-08 14:14 ` Robert Eachus
2017-04-09  0:30 ` antispam
2017-04-09  8:47   ` Jeffrey R. Carter
2017-04-09 19:25     ` antispam
2017-04-10 17:18       ` Jeffrey R. Carter
2017-04-11 21:39         ` antispam
2017-04-09  7:15 ` Paul Rubin
2017-04-09  8:56   ` Jeffrey R. Carter
2017-04-09 21:18     ` Paul Rubin
2017-04-10 17:08       ` Jeffrey R. Carter [this message]
2017-04-10 19:39         ` Paul Rubin
2017-04-09 10:05   ` Jeffrey R. Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox