[Rcpp-devel] Inf to NA.

Dirk Eddelbuettel edd at debian.org
Tue Dec 21 18:46:17 CET 2010


Ah yes, of course -- thanks to Gabor and Romain swinging two simultaneous
cluebats at me.  Here is your question as a two-liner:

R> infEcho <- cxxfunction(signature(x="numeric"), '
+   double z = Rcpp::as<double>(x);
+   return(Rcpp::wrap(z)); ', plugin="Rcpp")
R> infEcho(Inf)
[1] Inf
R> infEcho(NA)
[1] NA
R> infEcho(NaN)
[1] NaN
R> 


Dirk

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


More information about the Rcpp-devel mailing list