summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-05-23 02:18:40 +0900
committerYukihiro Matsumoto <[email protected]>2012-05-23 02:18:40 +0900
commitf44acf7bf87c8f4ad258a41bb7884c1f09a8aab9 (patch)
treec9d1b95de89dad5c809c71ea091c2b7f94ae3f3a /src
parent1eb02552eae24854f66ecc32104f6c2dcf6a9efb (diff)
downloadmruby-f44acf7bf87c8f4ad258a41bb7884c1f09a8aab9.tar.gz
mruby-f44acf7bf87c8f4ad258a41bb7884c1f09a8aab9.zip
explicit normalization -0.0 to 0.0
Diffstat (limited to 'src')
-rw-r--r--src/numeric.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/numeric.c b/src/numeric.c
index cddd7af27..a959718dd 100644
--- a/src/numeric.c
+++ b/src/numeric.c
@@ -372,7 +372,8 @@ flo_hash(mrb_state *mrb, mrb_value num)
int i, hash;
d = (mrb_float)mrb_fixnum(num);
- if (d == 0) d = fabs(d);
+ /* normalize -0.0 to 0.0 */
+ if (d == 0) d = 0.0;
c = (char*)&d;
for (hash=0, i=0; i<sizeof(mrb_float);i++) {
hash = (hash * 971) ^ (unsigned char)c[i];