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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7f5b20ce91c7fdaf X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Julian Dates package? Date: 1997/01/08 Message-ID: #1/1 X-Deja-AN: 208730077 references: <32CFFA13.5BF8@ibm.net> <32D36A52.5925@gsfc.nasa.gov> organization: New York University newsgroups: comp.lang.ada Date: 1997-01-08T00:00:00+00:00 List-Id: 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!