diff --git a/src/support/safe_integer.cpp b/src/support/safe_integer.cpp index 23ef84b22b2..d43f7a6aa30 100644 --- a/src/support/safe_integer.cpp +++ b/src/support/safe_integer.cpp @@ -22,7 +22,7 @@ using namespace wasm; -bool wasm::isInteger(double x) { return fmod(x, 1) == 0; } +bool wasm::isInteger(double x) { return trunc(x) == x && !std::isinf(x); } bool wasm::isUInteger32(double x) { return !std::signbit(x) && isInteger(x) &&