comp.lang.ada
 help / color / mirror / Atom feed
From: Jeff Carter <jrcarter@acm.org>
Subject: Re: Using "delay until" in real-time
Date: Tue, 12 Dec 2000 23:18:41 GMT
Date: 2000-12-12T23:18:41+00:00	[thread overview]
Message-ID: <3A36B24A.EDF4755D@acm.org> (raw)
In-Reply-To: 9161h3$7n0$1@hobbes2.crc.com

"David C. Hoos, Sr." wrote:
> 
> Well... the first thing I'd do is to use Long_Float for the frequency.
> This alone will reduce the drift rate by 11 orders of magnitude, by
> providing 11 more correct (decimal) digits in the computation of
> the interval.
> 
> "Ted Dennison" <dennison@telepath.com> wrote in message
> news:915jl7$jt5$1@nnrp1.deja.com...
> > Iteration_Hz : constant Float := 60.0;

That's incorrect. Not all compilers provide Long_Float, so the
suggestion is not portable. The increased precision from Long_Float, if
it exists, may not be 11 more digits. You could use

type Big is digits System.Max_Digits;

to obtain the maximum floating-point precision for the compiler.

It is the fact that this is a typed constant that is causing the loss of
precision. If it were a named number, the expression

1.0 / Iteration_Hz [I'll call this Increment]

would be a static universal real expression instead of a Float
expression, the conversion to Duration would be unnecessary, and the
result would have the full precision and accuracy of Duration.

However, that would still not be exact. You probably need to combine
various numbers of applications of the rounded-down and rounded-up
values of Increment so that after 30 of these you have delayed exactly
0.5 seconds.

-- 
Jeff Carter
"You brightly-colored, mealy-templed, cranberry-smelling, electric
donkey-bottom biters."
Monty Python & the Holy Grail



  parent reply	other threads:[~2000-12-12 23:18 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-12 16:27 Using "delay until" in real-time Ted Dennison
2000-12-12 18:01 ` Mike Silva
2000-12-12 19:57   ` Ted Dennison
2000-12-12 23:02     ` Mike Silva
2000-12-12 23:49       ` Ted Dennison
2000-12-18  6:26     ` Ray Blaak
2000-12-12 20:00 ` Ken Garlington
2000-12-12 20:40   ` Ted Dennison
2000-12-13  4:02     ` Ken Garlington
2000-12-13 14:29       ` Ted Dennison
2000-12-13 16:53     ` Larry Hazel
2000-12-13 17:41       ` Ted Dennison
2000-12-12 20:22 ` Keith Thompson
2000-12-12 20:54   ` Ted Dennison
2000-12-13  5:35   ` tmoran
2000-12-12 20:23 ` David C. Hoos, Sr.
2000-12-12 21:58   ` Ted Dennison
2000-12-12 23:18   ` Jeff Carter [this message]
2000-12-12 21:18 ` JP Thornley
2000-12-12 22:31   ` Ted Dennison
2000-12-13  8:02     ` Brian Orpin
2000-12-13 17:32     ` JP Thornley
2000-12-12 23:09 ` Ted Dennison
2000-12-13  7:43 ` Brian Orpin
2000-12-15  0:27 ` Frank
2000-12-19  7:50 ` Martin Gangkofer
2000-12-20  3:32   ` Ted Dennison
2000-12-20  5:29     ` tmoran
2000-12-20  7:59     ` Martin Gangkofer
2000-12-20  9:15       ` java servlets JF Harrison
2000-12-20 12:50     ` Using "delay until" in real-time Marin David Condic
2000-12-21  0:08     ` Alejandro R. Mosteo
2000-12-20  3:17 ` Ted Dennison
replies disabled

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