diff --git a/eo-runtime/src/main/eo/number.eo b/eo-runtime/src/main/eo/number.eo index 9945bba3bad..9abf67187c2 100644 --- a/eo-runtime/src/main/eo/number.eo +++ b/eo-runtime/src/main/eo/number.eo @@ -118,7 +118,11 @@ # the original, so we subtract `1` in that single case. [] > floor if. > @ - ^.is-finite.not + or. + ^.is-finite.not + or. + ^.gte 4503599627370496 + ^.lte -4503599627370496 ^ if. trunc.gt ^ @@ -394,6 +398,18 @@ -5.floor -5 + # Tests that floor of a very large positive number >= 2^52 returns itself. + [] +> tests-floor-of-large-positive-integer + eq. > @ + 100000000000000000000.floor + 100000000000000000000 + + # Tests that floor of a very large negative number <= -2^52 returns itself. + [] +> tests-floor-of-large-negative-integer + eq. > @ + -100000000000000000000.floor + -100000000000000000000 + # Tests that floor of zero returns zero. [] +> tests-floor-of-zero eq. > @