From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: next_period = start + n*period; versus next_period = next_period+period;
Date: Wed, 27 Oct 2004 09:35:39 +0200
Date: 2004-10-27T09:35:39+02:00 [thread overview]
Message-ID: <n5ig8j7aogc2$.ijonbzhl0ms8.dlg@40tude.net> (raw)
In-Reply-To: 87sm81o0vt.fsf@deneb.enyo.de
On Tue, 26 Oct 2004 19:16:54 +0200, Florian Weimer wrote:
> * Paul Colin Gloster:
>
>> however someone I am acquainted with swears by multiplication as in
>> delay until Next_Period; where Next_Period := Start + Iteration*Period;
>> instead, and demonstrated an example where it is more accurate. The
>> following MATLAB excerpt illustrates this:
>
> Time_Span doesn't use floating point arithmetic in Ada, and this
> effect doesn't occur.
Right. However there could be other issues to consider:
1. The example given uses conversion of integer time cycle to time span. It
can become a source of cumulative error when 1 microsecond has no exact
representation in Time_Span. That depends on the underlying hardware.
2. What happens when the task misses a deadline? Usually it should skip one
"tick" and go to the next one.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2004-10-27 7:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-26 16:20 next_period = start + n*period; versus next_period = next_period+period; Paul Colin Gloster
2004-10-26 17:16 ` Florian Weimer
2004-10-27 7:35 ` Dmitry A. Kazakov [this message]
2004-10-27 13:46 ` Mark H Johnson
2004-10-27 14:41 ` Dmitry A. Kazakov
2004-10-28 13:37 ` Mark H Johnson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox