Skip to content

timeDate

4 messages · james.holtman@convergys.com, Martin Maechler, Brian Ripley

#
You might want to check out 'chron'.  This stores the time as days and
fractions of a day.

If you take the current date,
[1] 12745
you get the value above.  If you change this to millisecond, you get
[1] 1.101168e+12
this value requires 46 bits and since a floating point number has 54 bits
of value, it should be enough to give you millisecond resolution and still
maintain the 'date'
__________________________________________________________
James Holtman        "What is the problem you are trying to solve?"
Executive Technical Consultant  --  Office of Technology, Convergys
james.holtman at convergys.com
+1 (513) 723-2929


                                                                                                                                           
                      Yasser El-Zein                                                                                                       
                      <abu3ammar at gmail.com>        To:       r-help at stat.math.ethz.ch                                                      
                      Sent by:                     cc:                                                                                     
                      r-help-bounces at stat.m        Subject:  Re: [R] timeDate                                                              
                      ath.ethz.ch                                                                                                          
                                                                                                                                           
                                                                                                                                           
                      11/23/2004 09:55                                                                                                     
                      Please respond to                                                                                                    
                      Yasser El-Zein                                                                                                       
                                                                                                                                           
                                                                                                                                           




I am looking for up to the millisecond resolution. Is there a package
that has that?


On Mon, 22 Nov 2004 21:48:20 +0000 (UTC), Gabor Grothendieck
<ggrothendieck at myway.com> wrote:
http://www.R-project.org/posting-guide.html
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
#
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.

    james> it should be enough to give you millisecond resolution and still
    james> maintain the 'date'
#
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, 

    MM> no, only 52 bits  (64 = 52+1+12+1) with sign bits for exponent
    MM> and mantissa.

so much on the theme of mathematicians and arithmetic !
   64 = 52 + 1 + 10 + 1

Martin
#
On Tue, 23 Nov 2004, Martin Maechler wrote:

            
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.'