Skip to content

Commit 1e812ea

Browse files
committed
pedantic fixes for REALSXP -> STRSXP conversion (matches R)
1 parent 51d2965 commit 1e812ea

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

inst/include/Rcpp/internal/r_coerce.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ template <>
271271
inline SEXP r_coerce<REALSXP,STRSXP>(double from){
272272
// handle NaN explicitly
273273
if (R_IsNaN(from)) return Rf_mkChar("NaN");
274+
else if (from == R_PosInf) return Rf_mkChar("Inf");
275+
else if (from == R_NegInf) return Rf_mkChar("-Inf");
274276
else return Rcpp::traits::is_na<REALSXP>(from) ? NA_STRING :Rf_mkChar( coerce_to_string<REALSXP>( from ) ) ;
275277
}
276278
template <>

0 commit comments

Comments
 (0)