comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Julian Dates package?
Date: 1997/01/08
Date: 1997-01-08T00:00:00+00:00	[thread overview]
Message-ID: <dewar.852774697@merv> (raw)
In-Reply-To: 32D36A52.5925@gsfc.nasa.gov


Keith said

"> That's not guaranteed to work.  The subtraction operation returns a
> result of type Duration, which is a fixed-point type with a minimum range
> of -86400.0 .. +86400.0 (i.e., +/- 1 day).  Thus, you can't portably
> subtract two Calendar.Time values more than a day apart."

This is not just theoretical. In all versions of GNAT, we use a 64-bit
value for both time and duration, so any possible period is easily covered,
but other compilers (in particular Object Ada, and maybe others) use a
32-bit representation for Duration, and the range is therefore much closer
to the required minimum (which was chosen precisely so that a 32-bit type
is somewhat usable).

We decided in GNAT to use a 64-bit type, because we don't want to have
to compromise on either the range or precision (in GNAT Duration'Small
is in nanoseconds), and the 32-bit type requires both the range and
precision to be crunched. 

But code that assumes a large range is definitely not necessarily portable,
though it will port from one version of GNAT to another!





  reply	other threads:[~1997-01-08  0:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-05  0:00 Julian Dates package? Jay Joiner
     [not found] ` <01bbfb55$c9dcbfe0$5e2d5c8b@jerryware>
1997-01-06  0:00   ` Mike Stark
1997-01-09  0:00   ` Gautier
1997-01-13  0:00     ` Michael & Amy Hartsough
1997-01-08  0:00 ` Fintan
1997-01-08  0:00 ` Keith Thompson
1997-01-08  0:00   ` Mike Stark
1997-01-08  0:00     ` Robert Dewar [this message]
1997-01-09  0:00 ` Mats Weber
replies disabled

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