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=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8c3f76cf9b2829c4 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-01-29 06:03:50 PST Path: supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!logbridge.uoregon.edu!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!news.mindspring.net!not-for-mail From: Marin David Condic Newsgroups: comp.lang.ada Subject: Re: Duration vs. Ada.Real_Time Date: Mon, 29 Jan 2001 09:02:46 -0500 Organization: MindSpring Enterprises Message-ID: <3A757805.78048F92@acm.org> References: <980495512.529981@edh3> <3A71814B.7E8CCF60@acm.org> <94s5bl$r1r$1@nnrp1.deja.com> <3A71E4F6.6D7015AD@acm.org> <94vo82$kst$1@nnrp1.deja.com> NNTP-Posting-Host: d1.56.b7.08 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 29 Jan 2001 14:01:56 GMT X-Mailer: Mozilla 4.07 [en] (WinNT; I) Xref: supernews.google.com comp.lang.ada:4651 Date: 2001-01-29T14:01:56+00:00 List-Id: Robert Dewar wrote: > In article <3A71E4F6.6D7015AD@acm.org>, > Marin David Condic wrote: > > > I would think that a reasonable implementation of Ada for > > realtime systems would want to insure that the precision had > > some relationship to the accuracy of the clock available. > > Why do you think that? > Because as a real-time programmer, I feel like it. :-) Just because it would be reasonably useful to me if Duration were a scaled integer that just so happened to match exactly the scaled integer representation of the time source I had available to me. > > The RM contains no encouragement for this thought! > And that matters to me why? Just because the ARM didn't make a pronouncement on it doesn't stop it from being useful to me. And if you are selling me a product and I express my desires for what that product should do, and you appeal to the ARM to tell me my desires are not reasonable, would you be surprised when I pick a different compiler? > > Duration is used for other things besides the delay statement. > O.K. And I suppose I could probably use Duration for a thousand things that had nothing whatsoever to do with time. If Duration were the same size as Long_Long_Float, I might use it to do matrix multiplication - just because it was there and handy. I don't think that would change my position on why I'd like the type to correspond (as much as is possible) to whatever time source I have available. > > And also, programs do various calculations with Duration, if > there is more precision, these calculations are more accurate. > That may very well be true depending on the implementation. I don't think that changes anything for me. I'd bet a nickle that if you looked at all the math ops performed on anything of type Duration, you'd find that most of them were adds, the next level would be subtracts and all other math ops would fall so far into the weeds as to be of little concern. Yes, I know you can come up with cases where this may not hold. In practice, I just don't think it would come up that often. If Duration is a fixed point type with a delta that lines up to the LSB of my time source (and I have never seen a hardware source that gave me time as a floating point number - maybe they exist - I've never seen one.) then it would seem to me that I am computing at the resolution of my ability to measure. Given that (for most real time systems) I'm 99% of the time going to be adding and subtracting, I don't think extra low order bits are going to help me out here much. If I *really* needed to do some sort of complex math with a bunch of Durations where I thought that rounding errors might accumulate & become a problem, I guess I'd convert them to a Long_Long_Float (or Long_Long_Long_Float? :-), do the math, then convert back. I find that doing any sort of complex math with scaled integers is a good way to inject errors into the code anyway. Maybe you've got to do that because of hardware, but it isn't what I'd prefer. MDC -- ====================================================================== Marin David Condic - Quadrus Corporation - http://www.quadruscorp.com/ Send Replies To: m c o n d i c @ q u a d r u s c o r p . c o m Visit my web site at: http://www.mcondic.com/ "I'd trade it all for just a little more" -- Charles Montgomery Burns, [4F10] ======================================================================