On 31 March 2014 at 10:51, Petre Caraiani wrote: | Am(ii,jj) = exp((jj+1)/(T-1)) ;
[...] | and use fun(a,b,A,T), I get a matrix of 1s. Is there something wrong with the | division in this Cpp code? | | I get the same thing when I write: Am(ii,jj) = exp((jj+1)/(T-1)*log(a[ii])) ; | but, again, the results are normal if I just write: Am(ii,jj) = log(a[ii]) You sometimes need to help the compiler and make things a double variable. Try this Am(ii,jj) = exp((jj+1.0)/(T-1.0)); // 1.0 forces double and/or Am(ii,jj) = exp((jj+1.0)/(T-1.0)*log(a[ii])); Dirk -- Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel