Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isfinite for msvc #4612

Merged
merged 1 commit into from
Apr 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vigsterkr this should solve your ruby issue

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise you might have to include header at the top of the swig file, like here

#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