summaryrefslogtreecommitdiff
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
commit45cd729f17d6585c00241b230f2f2dd0e5e2db52 (patch)
tree70fb7df0929be692d36fa92011ef232e7fe270a2
parent330be69e4310886cc0d54356b2273113d288d9b1 (diff)
* numeric.c (flo_hash): normalize -0.0 to 0.0. [ruby-core:24577]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--numeric.c2
2 files changed, 6 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 555deb38e8..1392993f89 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,10 @@ Mon Aug 3 13:05:22 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* array.c (rb_ary_{permutation,combination,product}): must not use
ary_discard on strings.
+Mon Aug 3 06:43:25 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (flo_hash): normalize -0.0 to 0.0. [ruby-core:24577]
+
Mon Aug 3 00:32:00 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* random.c (rb_random_int): arguments have to be converted to
diff --git a/numeric.c b/numeric.c
index 3330e26933..57e420bb86 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);
}