Skip to content

Commit ce876de

Browse files
committed
fixup! Runtime: normalize nan when hashing floats
1 parent 88fbc89 commit ce876de

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

runtime/js/hash.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ function caml_hash_mix_float(hash, v0) {
5454
l = 0x00000001;
5555
} else if (h === (0x80000000 | 0) && l === 0) {
5656
/* Normalize -0 into +0 */
57-
h = 1;
57+
// This code path is not used by caml_hash because 0 and -0 look
58+
// like integers
59+
h = 0;
5860
}
5961
hash = caml_hash_mix_int(hash, l);
6062
hash = caml_hash_mix_int(hash, h);

0 commit comments

Comments
 (0)