From 206f3cdbe0454c695a72c969c527bda3cdc8a4b3 Mon Sep 17 00:00:00 2001 From: Tianqi Chen Date: Mon, 4 May 2015 11:13:14 -0700 Subject: [PATCH] msvc --- src/utils/math.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/utils/math.h b/src/utils/math.h index 06612b1a8..e0bf8c466 100644 --- a/src/utils/math.h +++ b/src/utils/math.h @@ -6,11 +6,7 @@ * \author Tianqi Chen */ #include -#ifdef _MSC_VER -extern "C" { -#include -} -#endif + namespace xgboost { namespace utils { #ifdef XGBOOST_STRICT_CXX98_ @@ -21,14 +17,24 @@ double LogGamma(double v); template inline bool CheckNAN(T v) { #ifdef _MSC_VER - return (_isnan(x) != 0); + return (_isnan(v) != 0); #else return isnan(v); #endif } template inline T LogGamma(T v) { +#ifdef _MSC_VER +#if _MSC_VER >= 1800 return lgamma(v); +#else +#pragma message ("Warning: lgamma function was not available until VS2013, poisson regression will be disabled") + utils::Error("lgamma function was not available until VS2013"); + return static_cast(1.0); +#endif +#else + return lgamma(v); +#endif } #endif } // namespace utils