aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/utils.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-03-27 17:27:28 +0100
committerBjörn-Egil Dahlberg <[email protected]>2015-03-27 17:27:28 +0100
commit740f19448e936d9f03ceb50d27ec1a76749dda6a (patch)
treee6e5f471de23490c4cdbb604e417b5caad206da0 /erts/emulator/beam/utils.c
parentf299a96c88eccbcfce1deed1bbf20d20f455805c (diff)
downloadotp-740f19448e936d9f03ceb50d27ec1a76749dda6a.tar.gz
otp-740f19448e936d9f03ceb50d27ec1a76749dda6a.tar.bz2
otp-740f19448e936d9f03ceb50d27ec1a76749dda6a.zip
erts: Fix make_internal_hash for 0.0 vs -0.0
The internal_hash should produce the same hash value for identical terms, in this case 0.0 =:= -0.0.
Diffstat (limited to 'erts/emulator/beam/utils.c')
-rw-r--r--erts/emulator/beam/utils.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/erts/emulator/beam/utils.c b/erts/emulator/beam/utils.c
index 8fc8962e4f..91f4accd30 100644
--- a/erts/emulator/beam/utils.c
+++ b/erts/emulator/beam/utils.c
@@ -1894,10 +1894,12 @@ make_internal_hash(Eterm term)
{
FloatDef ff;
GET_DOUBLE(term, ff);
+ if (ff.fd == 0.0) {
+ ff.fd = 0.0; /* ensure pos. 0.0 */
+ }
UINT32_HASH_2(ff.fw[0], ff.fw[1], HCONST_12);
goto pop_next;
}
-
default:
erl_exit(1, "Invalid tag in make_hash2(0x%X)\n", term);
}