[R] timeDate

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Nov 23 17:32:40 CET 2004


On Tue, 23 Nov 2004, Martin Maechler wrote:

>>>>>> "james" == james holtman <james.holtman at convergys.com>
>>>>>>     on Tue, 23 Nov 2004 10:39:04 -0500 writes:
>
>    james> You might want to check out 'chron'.  This stores the
>    james> time as days and fractions of a day.
>
>    james> If you take the current date,
>
>    >> as.numeric(chron(dates.="11/23/2004"))
>    james> [1] 12745
>    >>
>
>    james> you get the value above.  If you change this to
>    james> millisecond, you get
>
>    >> as.numeric(chron(dates.="11/23/2004")) * 86400 * 1000
>    james> [1] 1.101168e+12
>    >>
>
>    james> this value requires 46 bits and since a floating
>    james> point number has 54 bits of value,
>
> no, only 52 bits  (64 = 52+1+12+1) with sign bits for exponent
> and mantissa.

But with an implicit '1' for the first digit in a normalized number.

http://docs.sun.com/source/806-3568/ncg_math.html is one source.  E.g.

`The 52-bit fraction combined with the implicit leading significand bit 
provides 53 bits of precision in double-format normal numbers.'

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list