comp.lang.ada
 help / color / mirror / Atom feed
From: "Peter C. Chapin" <chapinp@acm.org>
Subject: Re: Another question about fixed point types.
Date: Sun, 29 Aug 2010 07:23:56 -0400
Date: 2010-08-29T07:23:56-04:00	[thread overview]
Message-ID: <4c7a4390$0$2390$4d3efbfe@news.sover.net> (raw)
In-Reply-To: <op.vh6sgwjeule2fv@garhos>

On 2010-08-29 02:32, Yannick Duchêne (Hibou57) wrote:

> If it is symmetric around zero, that should explain your observations,
> as I would be very surprised if there would be provision for a hole
> somewhere. If it is symmetric around zero, and there is no two disjoint
> range, then this is include zero.
> 
> A tiny test program which would write first and last of the base type
> may tell more.

You're right. Thanks for pointing that out. Here is the range of
Julian_Day'Base that I obtained using a test program:

-9007199254740992.000 .. 9007199254740991.999

So my understanding was that for integral types the compiler is allowed
to allocate only the number of bits necessary to hold the range. For
example:

type Example_Type is range 1000 .. 1001;

The compiler is permitted (not required) to represent objects of type
Example_Type using only a single bit. But I guess this is a separate
issue. The base type, in which computations are done, might be wide even
if the compiler chooses to store the objects in a much small space.

So in my case as Phil explained computations on Julian Day are being
done, most likely, with a 64 bit type. Yet despite that, storage could
(perhaps) be using a smaller space since 64 bits is not needed to
represent the full range of Julian_Day at my specified resolution.

I understand that these details are compiler specific. However, it does
seem like my code, at least, should be portable in its effect.

Peter



  reply	other threads:[~2010-08-29 11:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-28 22:45 Another question about fixed point types Peter C. Chapin
2010-08-29  6:32 ` Yannick Duchêne (Hibou57)
2010-08-29 11:23   ` Peter C. Chapin [this message]
2010-08-29  9:02 ` Phil Thornley
2010-08-29 11:29   ` Peter C. Chapin
2010-08-29 12:31     ` Phil Thornley
2010-08-29 13:49       ` Jeffrey Carter
2010-08-29 14:20       ` Peter C. Chapin
2010-08-29 17:50         ` Phil Thornley
2010-08-29 22:03           ` Peter C. Chapin
2010-08-30  8:50           ` Mark Lorenzen
2010-08-29 10:24 ` Simon Wright
2010-08-29 14:02 ` Stephen Leake
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox