[Rcpp-devel] Negative vector lengths from rep_each

Dirk Eddelbuettel edd at debian.org
Mon Oct 29 18:51:43 CET 2018


On 29 October 2018 at 12:43, Barth Riley wrote:
| Thanks, Dirk. Would it matter if I initialize the values in the array to missing (NA_REAL)?

I think you misunderstood my previous email (which you chose not to quote).

First:

  R> .Machine$integer.max
  [1] 2147483647
  R> 

Second:

  R> Rcpp::cppFunction("int addTwoInts(int a, int b) { return a+b; }")
  R> addTwoInts(2147483640L,5L)  # less than max
  [1] 2147483645
  R> addTwoInts(2147483640L,10L) # more than max
  [1] -2147483646
  R> 

You could trying using _double_ for your indices.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rcpp-devel mailing list