[Rcpp-devel] int double multiplication

Dirk Eddelbuettel edd at debian.org
Tue Jun 21 16:49:50 CEST 2016


On 21 June 2016 at 16:33, Andreas Prescher wrote:
| 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?

Please provide a _complete_ and _reproducible_ example.

Dirk


| 
| 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)
| 
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

-- 
While traveling abroad, the router hung which left me unable to access email
for a few days (and also blocked access to my website, blog, @cranberries, ...)
Please accept my apologies for delayed and/or somewhat brief replies.
--
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rcpp-devel mailing list