[R] julian() and numerical noise

Andreas Eckner andreas at eckner.com
Fri Mar 23 21:17:45 CET 2012


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



More information about the R-help mailing list