aboutsummaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/numeric.c b/numeric.c
index 1950754f60..042daafaeb 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1137,10 +1137,14 @@ flo_eq(VALUE x, VALUE y)
static VALUE
flo_hash(VALUE num)
{
- double d;
+ return rb_dbl_hash(RFLOAT_VALUE(num));
+}
+
+VALUE
+rb_dbl_hash(double d)
+{
st_index_t hash;
- d = RFLOAT_VALUE(num);
/* normalize -0.0 to 0.0 */
if (d == 0.0) d = 0.0;
hash = rb_memhash(&d, sizeof(d));