Hi,

In message "[ruby-talk:13315] A subtle Hash bug"
    on 01/03/29, "Christoph Rippel" <crippel / primenet.com> writes:

|I recently run into the the following bug 
|   
|(-0.0).eql? (0.0)        #  => true
|(-0.0).hash == (0.0).hash # => false

Oops, quick hack patch is attached.

|If one wants to fix this one has explicitly check for the -0.0 bit pattern. 
|The other possibility is to declare that 
| 
|          -0.0.eql 0.0  # => false  
|
|in which case one has to check for the -0.0 pattern in the #eql? method 
|which is actually better IMO. 

The patch does the former, since it's far easier to implement.  Then,
which do you think is better, community people?


							matz.

--- numeric.c	2001/03/13 05:45:09	1.22
+++ numeric.c	2001/03/29 09:29:46
@@ -450,2 +450,3 @@
     d = RFLOAT(num)->value;
+    if (d == 0) d = fabs(d);
     c = (char*)&d;