Skip to content

Commit

Permalink
isfinite for msvc
Browse files Browse the repository at this point in the history
  • Loading branch information
gf712 authored and vigsterkr committed Apr 17, 2019
1 parent ae09c50 commit 6523887
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/shogun/util/converters.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@

#include <shogun/lib/common.h>

#ifdef _MSC_VER
#include <cfloat>
// TODO: microsoft should really start supporting c++11
#define IS_FINITE(x) _isfinite(x)
#else
#include <cmath>
#define IS_FINITE(x) std::isfinite(x)
#endif

namespace shogun
{
namespace utils
Expand All @@ -29,7 +38,7 @@ namespace shogun
std::is_signed<I>::value && std::is_signed<J>::value, I>
safe_convert(J value)
{
if (std::isfinite(value) &&
if (IS_FINITE(value) &&
(value < std::numeric_limits<I>::lowest() ||
value > std::numeric_limits<I>::max()))
throw std::overflow_error(
Expand Down

0 comments on commit 6523887

Please sign in to comment.