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: 103376,16dbd7ecc6a3d50c X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!skynet.be!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Ada decimal types Date: Sat, 06 May 2006 16:48:06 +0100 Organization: Pushface Message-ID: References: NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1146930485 13195 62.49.19.209 (6 May 2006 15:48:05 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Sat, 6 May 2006 15:48:05 +0000 (UTC) Cancel-Lock: sha1:FdG76VRtNkS8ph6SCoM8IaJsBVg= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) Xref: g2news2.google.com comp.lang.ada:4116 Date: 2006-05-06T16:48:06+01:00 List-Id: "REH" writes: > "Keith Thompson" wrote in message > news:lnmzdvttoc.fsf@nuthaus.mib.org... >> And it's the small, not the delta, that needs to be 1.0e-6. If you >> specify a delta of 1.0e-6 for an ordinary fixed-point type without >> specifying the small, you'll (probabaly) get a small of 2.0**-20. >> (As you probably know.) > > It's not an binary fixed point, but a decimal fixed point. I believe the > small has to be a power of ten, not two. Anyways, that is a good point. > For a decimal type, do I need to specify the small? On GNAT, Duration (which is a plain fixed-point type) is effectively implemented as type Duration is delta 1.0e-9; for Duration'Small use 1.0e-9; for Duration'Size use 64; which means that the lsb is 1 nanosecond. I'm pretty sure that a compiler has to do what you tell it here (or reject the unit). It may well be that a decimal fixed point type would have exactly the same effect but I have never used one. type My_Duration is digits 9 delta 1.0e-9; for My_Duration'Size use 64; One point we came unstuck over: depending on your machine, the alignment of a 64-bit value may end up as 8 bytes, whereas the alignment of your POSIX-like representation would be 4 bytes. Had you considered just using Duration?