From 49421e42a8082a1b75dda65411af3fb4b0ba9fe5 Mon Sep 17 00:00:00 2001 From: Max Graey Date: Tue, 7 Jul 2020 00:17:02 +0300 Subject: More efficient isInteger util (#2945) --- src/support/safe_integer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/support/safe_integer.cpp b/src/support/safe_integer.cpp index 23ef84b22..d43f7a6aa 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) && -- cgit v1.2.3