summaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-03 05:15:54 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-03 05:15:54 +0000
commitc4c232529a1639d21685c08646f10860e4672fee (patch)
tree70fb7df0929be692d36fa92011ef232e7fe270a2 /numeric.c
parent41398328fb5a560cd7c36c56176f405d42c15439 (diff)
downloadruby-c4c232529a1639d21685c08646f10860e4672fee.tar.gz
ruby-c4c232529a1639d21685c08646f10860e4672fee.tar.xz
ruby-c4c232529a1639d21685c08646f10860e4672fee.zip
* numeric.c (flo_hash): normalize -0.0 to 0.0. [ruby-core:24577]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/numeric.c b/numeric.c
index 3330e2693..57e420bb8 100644
--- a/numeric.c
+++ b/numeric.c
@@ -913,6 +913,8 @@ flo_hash(VALUE num)
int hash;
d = RFLOAT_VALUE(num);
+ /* normalize -0.0 to 0.0 */
+ if (d == 0.0) d = 0.0;
hash = rb_memhash(&d, sizeof(d));
return INT2FIX(hash);
}