comp.lang.ada
 help / color / mirror / Atom feed
From: Paul Rubin <no.email@nospam.invalid>
Subject: Re: Fun with Unbounded Rational Numbers
Date: Sun, 09 Apr 2017 14:18:31 -0700
Date: 2017-04-09T14:18:31-07:00	[thread overview]
Message-ID: <87mvbp8el4.fsf@nightsong.com> (raw)
In-Reply-To: occsq6$854$1@dont-email.me

"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?

The same calculation in compiled Haskell takes about 0.012 cpu seconds
including printing the answer, which is about 50k chars (i.e. 25k digits
for each of the numerator and denominator).

Doing 25 iterations takes about 2 minutes and uses around 250MB of
memory, giving an answer of around 50M chars.

You should get within 1e-8 or whatever it was in less than 5 iterations.

  reply	other threads:[~2017-04-09 21:18 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 [this message]
2017-04-10 17:08       ` Jeffrey R. Carter
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