aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2017-02-16 15:45:52 +0100
committerSverker Eriksson <[email protected]>2017-02-16 15:45:52 +0100
commitb10b410fd37f960d4842b35bd51ea0fb0506a186 (patch)
treeacdab34f73c24def828bf1ce926a8f36df14ff3f /erts/emulator/beam
parent381f97b30092624b238a68909855692929d6f8bf (diff)
parentd73423cdba178c166f25e00a4608ccc8d0465937 (diff)
downloadotp-b10b410fd37f960d4842b35bd51ea0fb0506a186.tar.gz
otp-b10b410fd37f960d4842b35bd51ea0fb0506a186.tar.bz2
otp-b10b410fd37f960d4842b35bd51ea0fb0506a186.zip
Merge branch 'sverker/round-bug/OTP-14227' into maint
* sverker/round-bug/OTP-14227: erts: Fix round/1 for large floats
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/erl_bif_guard.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/erts/emulator/beam/erl_bif_guard.c b/erts/emulator/beam/erl_bif_guard.c
index b42d2dc28b..74cf7cf11a 100644
--- a/erts/emulator/beam/erl_bif_guard.c
+++ b/erts/emulator/beam/erl_bif_guard.c
@@ -157,7 +157,7 @@ BIF_RETTYPE round_1(BIF_ALIST_1)
GET_DOUBLE(BIF_ARG_1, f);
/* round it and return the resultant integer */
- res = double_to_integer(BIF_P, (f.fd > 0.0) ? f.fd + 0.5 : f.fd - 0.5);
+ res = double_to_integer(BIF_P, round(f.fd));
BIF_RET(res);
}
@@ -597,8 +597,7 @@ Eterm erts_gc_round_1(Process* p, Eterm* reg, Uint live)
}
GET_DOUBLE(arg, f);
- return gc_double_to_integer(p, (f.fd > 0.0) ? f.fd + 0.5 : f.fd - 0.5,
- reg, live);
+ return gc_double_to_integer(p, round(f.fd), reg, live);
}
Eterm erts_gc_trunc_1(Process* p, Eterm* reg, Uint live)