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 hard to say, but I'd guess the maintainer didn't really consider a use case involving one quadrillionth of a day.
Is it problematic for you? If so, a workaround is not hard to provide Michael On Fri, Mar 23, 2012 at 4:17 PM, Andreas Eckner <andr...@eckner.com> wrote: > 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(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 numerical noise in the 'day' >>> argument, but not in the 'month' and 'year' argument? Another example: >>> >>> > julian(2 - 1e-15, 1, 2012) - julian(1 - 1e-15, 1, 2012) >>> [1] 30 >> >> >> >> Which vbersion of R are you talking about? >> >> I get: >> >> > julian(2, 1, 2012) - julian(2 - 1e-15, 1, 2012) >> Error in UseMethod("julian") : >> no applicable method for 'julian' applied to an object of class >> "c('double', 'numeric')" >> >> >> Uwe Ligges >> >> >>> Thanks, >>> Andreas >>> >>> ______________________________________________ >>> 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. >> >> >> > > ______________________________________________ > 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. ______________________________________________ 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.