Re: [R] julian() and numerical noise

2012-03-24 Thread Andreas Eckner
Very helpful, thanks! Andreas On 3/24/2012 10:57 AM, R. Michael Weylandt wrote: It might be easier to just work with a character representation rather than fighting the floating point demons: fnc<- function(date){ as.Date(paste(date, "01", sep = "."), format = "%Y.%m.%d") } Hope that hel

Re: [R] julian() and numerical noise

2012-03-24 Thread Andreas Eckner
Thanks for the help. A workaround seems indeed easy to write, for example, by rounding the the value of 'm' inside chron:::julian.default(), or only passing integers to the function. I never intended to use a case involving a quadrillionth of a day, but encountered the problem when converting

Re: [R] julian() and numerical noise

2012-03-24 Thread R. Michael Weylandt
It might be easier to just work with a character representation rather than fighting the floating point demons: fnc <- function(date){ as.Date(paste(date, "01", sep = "."), format = "%Y.%m.%d") } Hope that helps, Michael On Sat, Mar 24, 2012 at 10:47 AM, Andreas Eckner wrote: > Thanks for

Re: [R] julian() and numerical noise

2012-03-23 Thread R. Michael Weylandt
julian() is in the package base. chron only provides julian.default to avoid the error Uwe observed. If you look at the code for julian.default, it's not too hard to see why date will be slightly more sensitive to "numeric fuzz"whether that's intentional (or even a good/bad thing) is somewhat h

Re: [R] julian() and numerical noise

2012-03-23 Thread Andreas Eckner
Sorry, forgot to mention: R version 2.14.2 The function julian() is part of the "chron" package of the base distribution. On 3/23/2012 2:47 PM, Uwe Ligges wrote: On 23.03.2012 15:45, Andreas Eckner wrote: Hi, does anybody know if the following behavior of julian() is intentional? > julian(

Re: [R] julian() and numerical noise

2012-03-23 Thread Uwe Ligges
On 23.03.2012 15:45, Andreas Eckner wrote: Hi, does anybody know if the following behavior of julian() is intentional? > julian(2, 1, 2012) - julian(2 - 1e-15, 1, 2012) [1] 1 > julian(2, 1, 2012) - julian(2, 1 - 1e-15, 2012) [1] 0 > julian(2, 1, 2012) - julian(2, 1, 2012 - 1e-15) [1] 0 In o

[R] julian() and numerical noise

2012-03-23 Thread Andreas Eckner
Hi, does anybody know if the following behavior of julian() is intentional? > julian(2, 1, 2012) - julian(2 - 1e-15, 1, 2012) [1] 1 > julian(2, 1, 2012) - julian(2, 1 - 1e-15, 2012) [1] 0 > julian(2, 1, 2012) - julian(2, 1, 2012 - 1e-15) [1] 0 In other words, julian() is subject to numeri