aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-06-27 12:54:04 +0200
committerBjörn Gustavsson <[email protected]>2016-09-05 11:49:13 +0200
commit6d40cfd77f1d2f1e1403e4b41c0b53ae6499ea11 (patch)
tree774f51ba146c2b172b73bf778c6d8e820d0a0d9c /erts/emulator
parent986d32a62b20c32338dac4dfd27c141c8f9be0fe (diff)
downloadotp-6d40cfd77f1d2f1e1403e4b41c0b53ae6499ea11.tar.gz
otp-6d40cfd77f1d2f1e1403e4b41c0b53ae6499ea11.tar.bz2
otp-6d40cfd77f1d2f1e1403e4b41c0b53ae6499ea11.zip
Add math:floor/1 and math:ceil/1
Add math:floor/1 and math:ceil/1 to avoid unnecessary conversions in floating point expressions. That is, instead of having to write float(floor(X)) as part of a floating point expressions, we can write simply math:floor(X).
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/beam/bif.tab2
-rw-r--r--erts/emulator/beam/erl_math.c10
2 files changed, 10 insertions, 2 deletions
diff --git a/erts/emulator/beam/bif.tab b/erts/emulator/beam/bif.tab
index 67eae35dec..0bd80ea684 100644
--- a/erts/emulator/beam/bif.tab
+++ b/erts/emulator/beam/bif.tab
@@ -664,6 +664,8 @@ bif maps:take/2
gcbif erlang:floor/1
gcbif erlang:ceil/1
+bif math:floor/1
+bif math:ceil/1
#
# Obsolete
diff --git a/erts/emulator/beam/erl_math.c b/erts/emulator/beam/erl_math.c
index fc0aaed18a..990fa63bd4 100644
--- a/erts/emulator/beam/erl_math.c
+++ b/erts/emulator/beam/erl_math.c
@@ -247,6 +247,12 @@ BIF_RETTYPE math_pow_2(BIF_ALIST_2)
return math_call_2(BIF_P, pow, BIF_ARG_1, BIF_ARG_2);
}
+BIF_RETTYPE math_ceil_1(BIF_ALIST_1)
+{
+ return math_call_1(BIF_P, ceil, BIF_ARG_1);
+}
-
-
+BIF_RETTYPE math_floor_1(BIF_ALIST_1)
+{
+ return math_call_1(BIF_P, floor, BIF_ARG_1);
+}