From: Christoph Rippel Date: 2001-03-29T18:13:33+09:00 Subject: [ruby-talk:13315] A subtle Hash bug Hi, I recently run into the the following bug (-0.0).eql? (0.0) # => true (-0.0).hash == (0.0).hash # => false The reason for this that the hashing algorithm of float converts a double into a string and builds a hash key from this string. This does not work for (-0.0) and (0.0) because their bit pattern are different but the gcc at least claims that (in C ) -0.0 == 0.0 # => true. 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. Christoph