From: "REH" <me@you.com>
Subject: Re: Ada decimal types
Date: Sat, 06 May 2006 16:39:58 GMT
Date: 2006-05-06T16:39:58+00:00 [thread overview]
Message-ID: <yj47g.23728$ZQ3.20636@twister.nyroc.rr.com> (raw)
In-Reply-To: m2k68zm9xl.fsf@grendel.local
"Simon Wright" <simon@pushface.org> wrote in message
news:m2k68zm9xl.fsf@grendel.local...
> "REH" <me@you.com> writes:
>
>> "Keith Thompson" <kst-u@mib.org> 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?
The problem with that is that different compilers that we use define
different precisions for duration. Also, duration is a binary fixed point.
A don't want to use those because precision may be lost. Whether or not the
loss will be an issue, I do not know but I would rather not risk it. Of
course I just may be worrying over nothing.
Thanks.
REH
next prev parent reply other threads:[~2006-05-06 16:39 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-04 15:23 Ada decimal types REH
2006-05-04 18:17 ` Jeffrey R. Carter
2006-05-04 22:20 ` REH
2006-05-05 9:14 ` Stephen Leake
2006-05-05 11:33 ` REH
2006-05-05 16:49 ` tmoran
2006-05-05 18:08 ` REH
2006-05-05 18:49 ` tmoran
2006-05-05 18:59 ` REH
2006-05-06 8:59 ` Keith Thompson
2006-05-06 14:01 ` REH
2006-05-06 15:48 ` Simon Wright
2006-05-06 16:39 ` REH [this message]
2006-05-08 21:19 ` Randy Brukardt
2006-05-09 23:21 ` REH
2006-05-10 1:08 ` Keith Thompson
2006-05-10 5:37 ` Simon Wright
2006-05-10 12:22 ` REH
2006-05-10 20:47 ` Randy Brukardt
2006-05-10 21:26 ` REH
2006-05-10 20:52 ` Randy Brukardt
2006-05-11 5:51 ` Simon Wright
2006-05-11 22:33 ` Randy Brukardt
2006-05-05 20:32 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox