On Sun, Jan 19, 2014 at 2:45 AM, Prof Brian Ripley <rip...@stats.ox.ac.uk>wrote:

> On 17/01/2014 18:58, Gábor Csárdi wrote:
>
>> Hi all,
>>
>> I just run into this today. Apparently rexp() sometimes gives different
>> slightly results for the same seed on 32 bit and 64 bit machines. runif()
>> is the same for both, so the problem seems to be in rexp().
>>
>
> Rather, the 'problem' is in your expectations: different builds of R
> should be expected to give different results.
>

My expectation is the recommendation of IEEE-754 (2008) about
reproducibility, but I understand that it is not very easy to achieve this.
Just for the records, here is a discussion about this:
http://stackoverflow.com/questions/21212326/floating-point-arithmetic-and-reproducibility/21212366

[...]

And for the record: the reasons 32-bit results are often different
> include that the lowest common denominator for i686 cpus[*] is lower
> than for x86_64 ones. Also, the OS X results quoted most likely are for
> the CRAN distribution using a rather old compiler which does not
> optimize as well as current ones, and you are comparing different
> runtimes (libc), whereas I was comparing i686 and x86_64 compiles on the
> same machine, with the same compiler/runtime versions.
>

The results are the same with the most recent compilers on Mavericks. And
also the same with the most recent compilers in the most recent 64 bit
Ubuntu. They are only different on 32 bit Ubuntu, I'll test 32 bit windows
as well.

As the rexp code is very simple:
https://github.com/wch/r-source/blob/776708efe6003e36f02587ad47b2eaaaa19e2f69/src/nmath/sexp.c
I think this particular case can be fixed, but I might be wrong. Anyway,
I'll try to see what goes wrong here.

unif_rand() itself seems to be reproducible, of course this is not a real
test, but still:

set.seed(9) ; digest(runif(100000))
# [1] "620a1e3830e86f65523489003cc5f444"
sessionInfo()
# R version 3.0.2 (2013-09-25)
# Platform: i686-pc-linux-gnu (32-bit)

set.seed(9) ; digest(runif(100000))
# [1] "620a1e3830e86f65523489003cc5f444"
sessionInfo()
# R version 3.0.2 (2013-09-25)
# Platform: x86_64-unknown-linux-gnu (64-bit)

set.seed(9) ; digest(runif(100000))
# [1] "620a1e3830e86f65523489003cc5f444"
sessionInfo()
# R version 3.0.2 (2013-09-25)
# Platform: x86_64-apple-darwin10.8.0 (64-bit)

[*] And for R for Windows i386 cpus are still supported, alongside Windows
> XP.
>

[...]

        [[alternative HTML version deleted]]

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

Reply via email to