File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
inst/include/Rcpp/internal Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -268,8 +268,10 @@ inline SEXP r_coerce<CPLXSXP,STRSXP>(Rcomplex from) {
268268 return Rcpp::traits::is_na<CPLXSXP>(from) ? NA_STRING : Rf_mkChar ( coerce_to_string<CPLXSXP>( from ) ) ;
269269}
270270template <>
271- inline SEXP r_coerce<REALSXP,STRSXP>(double from){
272- return Rcpp::traits::is_na<REALSXP>(from) ? NA_STRING :Rf_mkChar ( coerce_to_string<REALSXP>( from ) ) ;
271+ inline SEXP r_coerce<REALSXP,STRSXP>(double from){
272+ // handle NaN explicitly
273+ if (R_IsNaN (from)) return Rf_mkChar (" NaN" );
274+ else return Rcpp::traits::is_na<REALSXP>(from) ? NA_STRING :Rf_mkChar ( coerce_to_string<REALSXP>( from ) ) ;
273275}
274276template <>
275277inline SEXP r_coerce<INTSXP ,STRSXP>(int from){
You can’t perform that action at this time.
0 commit comments