Skip to content

Commit 49421e4

Browse files
authored
More efficient isInteger util (#2945)
1 parent cd0cc95 commit 49421e4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/support/safe_integer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
using namespace wasm;
2424

25-
bool wasm::isInteger(double x) { return fmod(x, 1) == 0; }
25+
bool wasm::isInteger(double x) { return trunc(x) == x && !std::isinf(x); }
2626

2727
bool wasm::isUInteger32(double x) {
2828
return !std::signbit(x) && isInteger(x) &&

0 commit comments

Comments
 (0)