We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 56ba1d9 commit d7ea122Copy full SHA for d7ea122
src/core/value.c
@@ -322,6 +322,7 @@ int32_t janet_hash(Janet x) {
322
uint64_t u;
323
} as;
324
as.d = janet_unwrap_number(x);
325
+ as.d = as.d == 0 ? 0 : as.d; /* normalize negative 0 */
326
uint32_t lo = (uint32_t)(as.u & 0xFFFFFFFF);
327
uint32_t hi = (uint32_t)(as.u >> 32);
328
uint32_t hilo = (hi ^ lo) * 2654435769u;
test/suite0011.janet
@@ -48,5 +48,7 @@
48
49
(assert (= (test) '(1 ())) "issue #919")
50
51
+(assert (= (hash 0) (hash (* -1 0))) "hash -0 same as hash 0")
52
+
53
(end-suite)
54
0 commit comments