From: James Coglan Date: 2009-07-23T01:47:13+09:00 Subject: Re: Incorrect -0.0.hash - Ruby bug. --001636c5a82f53b4ae046f4e1f42 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 2009/7/22 John W Higgins > Morning Thomas, > > On Wed, Jul 22, 2009 at 9:24 AM, Thomas B. wrote: > > > Hello. I just found a bug in Ruby, version 1.9.1p0, Windows. > > > > In the rdoc to Object#hash we read > > (http://ruby-doc.org/core/classes/Object.html#M000337): > > > > "This function must have the property that a.eql?(b) implies a.hash == > > b.hash." > > > > Actually Float overrides both #eql? and #hash so the contract is not > applicable inside that class. Is that the best option in the world?? - > probably not - but that would make it a non bug in theory. Is there a reason for this? Perhaps the inexact nature of Floats means you ought not to use them as hash keys? -- James Coglan http://jcoglan.com --001636c5a82f53b4ae046f4e1f42--