Re: [R] Wrong computation of time differenze in POSIXct - additional digits

2012-06-15 Thread arun
Hi, I checked the same with strptime.  It is the rounding issue. Try this: dat1<-data.frame(datetime=c("2012-06-15 16:32:39.0025 CEST","2012-06-15 16:32:39.0086 CEST"))  op<-options(digits.secs=4)  dat1$datetime<- strptime(dat1$datetime, "%Y-%m-%d %H:%M:%OS") formatC(as.numeric(difftime(dat1[

Re: [R] Wrong computation of time differenze in POSIXct - additional digits

2012-06-15 Thread peter dalgaard
On Jun 15, 2012, at 20:33 , Rui Barradas wrote: > Hello, > > A classic of floating-point accuracy is > > > 3/5 - 3/5 > [1] 0 > > 3/5 - (2/5 + 1/5) > [1] -1.110223e-16 > > 3/5 - 2/5 - 1/5 > [1] -5.551115e-17 > > Rui Barradas > Yes. There are only about 16 significant digits in (64 bit) floati

Re: [R] Wrong computation of time differenze in POSIXct - additional digits

2012-06-15 Thread Rui Barradas
Hello, A classic of floating-point accuracy is > 3/5 - 3/5 [1] 0 > 3/5 - (2/5 + 1/5) [1] -1.110223e-16 > 3/5 - 2/5 - 1/5 [1] -5.551115e-17 Rui Barradas Em 15-06-2012 18:18, David Winsemius escreveu: On Jun 15, 2012, at 12:49 PM, Julia wrote: Hello, I wanted to compute the time differenze

Re: [R] Wrong computation of time differenze in POSIXct - additional digits

2012-06-15 Thread David Winsemius
On Jun 15, 2012, at 12:49 PM, Julia wrote: Hello, I wanted to compute the time differenze between to times: first =as.POSIXct( "2012-06-15 16:32:39.0025 CEST") second = as.POSIXct("2012-06-15 16:32:39.0086 CEST") second - first The result is Time difference of 0.006099939 secs instead of j