2008/11/7 tedzzx <[EMAIL PROTECTED]>:
>
> The problem is that: There is some rounding problems, for example
> Library(chron)
> any(times("4:00:01")==times("4:00:00")+times("00:00:01")))
> False
>
> But,it should be true

 FAQ 7.31 in disguise!

 chron stores date-times as fractions, so you're comparing two
floating point numbers here. FAQ 7.31 applies.

 Use 'all.equal', which has a method for chron that uses a 1 second
tolerance to match times:

> all.equal(times("4:00:01"),times("4:00:00")+times("00:00:01"))
[1] TRUE

Barry

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to