From: Joel VanderWerf Date: 2009-07-16T04:54:06+09:00 Subject: [ruby-core:24351] Re: is this expected? Roger Pack wrote: >> currently: >> >>>> {1 => 2} == {1 => 2.0} >> => true >> >>>> {1 => 2} == {1.0 => 2} >> => false >> >> This "mix floats and fixnums, sometimes it works, sometimes it >> doesn't" was somewhat surprising to me. > > Since there was no response, I'll consider this a bug of some sort. > The question is--should those 2 hashes be equal or not? No. "Hash uses key.eql? to test keys for equality." -- ri Hash. If it were true that {1 => 2} == {1.0 => 2}, then it would follow that {1 => 2}[1] == {1.0 => 2}[1] which is to say that 2 == nil -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407