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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f8311a3a7edd715 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-12-12 15:18:46 PST Path: supernews.google.com!sn-xit-02!supernews.com!isdnet!howland.erols.net!cyclone2.usenetserver.com!news-out.usenetserver.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3A36B24A.EDF4755D@acm.org> From: Jeff Carter X-Mailer: Mozilla 4.7 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Using "delay until" in real-time References: <915jl7$jt5$1@nnrp1.deja.com> <9161h3$7n0$1@hobbes2.crc.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Tue, 12 Dec 2000 23:18:41 GMT NNTP-Posting-Host: 199.174.148.104 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 976663121 199.174.148.104 (Tue, 12 Dec 2000 15:18:41 PST) NNTP-Posting-Date: Tue, 12 Dec 2000 15:18:41 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: supernews.google.com comp.lang.ada:3024 Date: 2000-12-12T23:18:41+00:00 List-Id: "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" 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