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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 115aec,47cd14062de43094 X-Google-Thread: 103376,47cd14062de43094 X-Google-Attributes: gid115aec,gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.realtime,comp.lang.ada Subject: Re: next_period = start + n*period; versus next_period = next_period+period; Date: Wed, 27 Oct 2004 09:35:39 +0200 Message-ID: References: <87sm81o0vt.fsf@deneb.enyo.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de sqGz/6fIZ7/62bUb7D0/Mg+VcWxz3Em58catnP3BoZXKhD1GA= User-Agent: 40tude_Dialog/2.0.12.1 Xref: g2news1.google.com comp.realtime:522 comp.lang.ada:5746 Date: 2004-10-27T09:35:39+02:00 List-Id: 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