Index: src/msvcmath.cpp
===================================================================
--- src/msvcmath.cpp	(revision 2051)
+++ src/msvcmath.cpp	(working copy)
@@ -1,15 +1,15 @@
 #ifdef _MSC_VER
 
 #include <math.h>
-#include <stdexcept>
 #include <Rcpp/msvc/math.h>
+#include <limits>
 
 // This is adapted from code by John D. Cook, released to public domain.
 // See http://www.johndcook.com/math_h.html.
 
 double log1p(double x) {
     if(x <= -1.0)
-	throw std::range_error("log1p: arg <= -1");
+	return std::numeric_limits<double>::quiet_NaN();
     if(fabs(x) > 1.e-4)
 	return log(1.0 + x);
     return (-0.5*x + 1.0)*x;
