[Rd] version comparison puzzle

Jari Oksanen jari.oksanen at oulu.fi
Thu Oct 3 10:27:12 CEST 2013


Actually, Bob O'Hara had a blog post about this in August 2012:

http://occamstypewriter.org/boboh/2012/08/17/lme4_destined_to_become_stable_through_rounding/

The concluding chapter reads:

"I have been worried that lme4 will never become stable, but this latest version mollifies me with the thought that the developers can’t go on forever, so eventually lme4 will become stable when the machine precision forces it to be rounded up to 1.0"

Cheers, Jari Oksanen
________________________________________
From: r-devel-bounces at r-project.org [r-devel-bounces at r-project.org] on behalf of Martyn Plummer [plummerm at iarc.fr]
Sent: 03 October 2013 11:15
To: Ben Bolker
Cc: R-devel at stat.math.ethz.ch
Subject: Re: [Rd] version comparison puzzle

It's an underflow problem. When comparing versions, "a.b.c" is converted
first to the integer vector c(a,b,c) and then to the double precision
value

a + b/base + c/base^2

where base is 1 greater than the largest integer component of any of the
versions: i.e 999999912 in this case.  The last term is then smaller
than the machine precision so you can't tell the difference between
1.0.4 and 1.0.5.

Martyn

On Wed, 2013-10-02 at 23:41 -0400, Ben Bolker wrote:
>      Can anyone explain what I'm missing here?
>
> max(pp1 <- package_version(c("0.99999911.3","1.0.4","1.0.5")))
> ## [1] ‘1.0.4’
>
> max(pp2 <- package_version(c("1.0.3","1.0.4","1.0.5")))
> ## [1] ‘1.0.5’
>
> I've looked at ?package_version , to no avail.
>
> Since max() goes to .Primitive("max")
> I'm having trouble figuring out where it goes from there:
> I **think** this is related to ?xtfrm , which goes to
> .encode_numeric_version, which is doing something I really
> don't understand (it's in base/R/version.R ...)
>
> .encode_numeric_version(pp1)
> ## [1] 1 1 1
> ## attr(,"base")
> ## [1] 99999912
> ## attr(,"lens")
> ## [1] 3 3 3
> ## attr(,".classes")
> ## [1] "package_version" "numeric_version"
>
> .encode_numeric_version(pp2)
> ## [1] 1.083333 1.111111 1.138889
> ## attr(,"base")
> ## [1] 6
> ## attr(,"lens")
> ## [1] 3 3 3
> ## attr(,".classes")
> ## [1] "package_version" "numeric_version"
>
> sessionInfo()
> R Under development (unstable) (2013-09-09 r63889)
> Platform: i686-pc-linux-gnu (32-bit)
>
> [snip]
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> loaded via a namespace (and not attached):
> [1] compiler_3.1.0 tools_3.1.0
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
R-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list