summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hash.c b/hash.c
index 6ab27e8a77..463c7c8e94 100644
--- a/hash.c
+++ b/hash.c
@@ -142,13 +142,16 @@ rb_any_hash(VALUE a)
}
else if (FLONUM_P(a)) {
/* prevent pathological behavior: [Bug #10761] */
- a = (st_index_t)rb_float_value(a);
+ return rb_dbl_hash(rb_float_value(a));
}
hnum = rb_objid_hash((st_index_t)a);
}
else if (BUILTIN_TYPE(a) == T_STRING) {
hnum = rb_str_hash(a);
}
+ else if (BUILTIN_TYPE(a) == T_FLOAT) {
+ return rb_dbl_hash(rb_float_value(a));
+ }
else {
hval = rb_hash(a);
hnum = FIX2LONG(hval);