[Rcpp-devel] int double multiplication

Andreas Prescher apres at kabelmail.de
Tue Jun 21 16:33:53 CEST 2016


Hello,

calling my function from R with
f(1/3) gives different results
on ubuntu 12.04 32 bit
and 14.04 64 bit, e.g:

void f(double d) {
	int i = vector.size() * d;
}
Given vector of size 75
I get 25 on 14.04 64 bit
and 24 on 12.04 32 bit.

Size of int is 4 byte,
double 8 byte on both systems.

Does anybody have an idea
how to get same result
on both machines?

Thanks in advance,

Andreas

(Further information:
14.04 64 bit machine:
g++ (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
R version 3.0.2 (2013-09-25)

12.04 32 bit:
g++ 4.6.3
R 3.2.2)



More information about the Rcpp-devel mailing list