diff options
author | Sverker Eriksson <[email protected]> | 2017-02-16 15:47:45 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2017-02-16 15:47:45 +0100 |
commit | fa8090d2d34e3755265192da09b588b966fd1158 (patch) | |
tree | 91921a994d49c963950ea8244b2ce5d2ec4799ab /erts | |
parent | dbf3754567fdc97a53da529e04400602c647ee7e (diff) | |
parent | b10b410fd37f960d4842b35bd51ea0fb0506a186 (diff) | |
download | otp-fa8090d2d34e3755265192da09b588b966fd1158.tar.gz otp-fa8090d2d34e3755265192da09b588b966fd1158.tar.bz2 otp-fa8090d2d34e3755265192da09b588b966fd1158.zip |
Merge branch 'maint' into 'master'
Diffstat (limited to 'erts')
-rw-r--r-- | erts/emulator/beam/erl_bif_guard.c | 5 | ||||
-rw-r--r-- | erts/emulator/test/guard_SUITE.erl | 1 | ||||
-rw-r--r-- | erts/emulator/test/num_bif_SUITE.erl | 3 |
3 files changed, 6 insertions, 3 deletions
diff --git a/erts/emulator/beam/erl_bif_guard.c b/erts/emulator/beam/erl_bif_guard.c index 458315f293..cdac4c1d11 100644 --- a/erts/emulator/beam/erl_bif_guard.c +++ b/erts/emulator/beam/erl_bif_guard.c @@ -190,7 +190,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); } @@ -630,8 +630,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) diff --git a/erts/emulator/test/guard_SUITE.erl b/erts/emulator/test/guard_SUITE.erl index e155e5f49f..54ee710363 100644 --- a/erts/emulator/test/guard_SUITE.erl +++ b/erts/emulator/test/guard_SUITE.erl @@ -317,6 +317,7 @@ guard_bifs(Config) when is_list(Config) -> try_gbif('float/1', Big, float(id(Big))), try_gbif('trunc/1', Float, 387924.0), try_gbif('round/1', Float, 387925.0), + try_gbif('round/1', 6209607916799025.0, 6209607916799025), try_gbif('length/1', [], 0), try_gbif('length/1', [a], 1), diff --git a/erts/emulator/test/num_bif_SUITE.erl b/erts/emulator/test/num_bif_SUITE.erl index 8016a21424..f62eb0b430 100644 --- a/erts/emulator/test/num_bif_SUITE.erl +++ b/erts/emulator/test/num_bif_SUITE.erl @@ -295,6 +295,9 @@ t_round(Config) when is_list(Config) -> 4294967297 = round(id(4294967296.9)), -4294967296 = -round(id(4294967296.1)), -4294967297 = -round(id(4294967296.9)), + + 6209607916799025 = round(id(6209607916799025.0)), + -6209607916799025 = round(id(-6209607916799025.0)), ok. %% Test trunc/1, floor/1, ceil/1, and round/1. |