Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion eo-runtime/src/main/eo/number.eo
Original file line number Diff line number Diff line change
Expand Up @@ -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 ^
Expand Down Expand Up @@ -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. > @
Expand Down
Loading