Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Re: Time of course

Steve Emmerson (steve@unidata.ucar.edu)
Thu, 13 Feb 92 09:11:51 -0700

Ethan Alpert wrote:

>My confusion stems from not understanding how you plan to use the 52 bit IEEE
>mantissa as a 52 bit integer. I understand that you simply have to use the
>LSB to advance the time counter but how are you going to disable the floating
>point of the machine, so as to prevent the machine from using the exponent part
>of the IEEE double.

Conversion between a double and an integral value is exact as long as
the integral value can be exactly represented in a double. There is no
need to type-pun or explicitly modify the LSB. As an example, note
that the following program prints "yes" after incrementing a double
value one million times:

main()
{
long n = 1000000;
double d = 0;

while (d < n)
++d;
(void) puts(d == n ? "yes" : "no");
}

We need only concern ourselves with integral values because we can
choose the "units" attributes such that only integral values are
necessary.

>Finally, if I want to select the first 10 milliseconds of June 1st for
>a ten year period from within my own application how would I do this.
>The conversion from the floating point representation would appear to
>be kind of mind twisting,

I intend to enhance the UDUNITS package so that it can be used for
this. My beliefs are that this approach (i.e. only dealing with the
"units" attributes") will be less burdensome on the programmer than
having to potentially handle multi-component base variables
everywhere, and that it will be sufficient for all but extremely
specialized datasets.

>when taking into account leap years and irregular month spacing. How will
>generic applications handle this?

A generic application should only concern itself with the units and
origins of coordinate variables. Time would be handled just like any
other dimension.

>Can a conversion utility library
>be developed to handle this?

I'm working on it.

--Steve

 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Office of Programs University Corporation for Atmospheric Research (UCAR)   Unidata is a member of the UCAR Office of Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690