Project

General

Profile

Actions

Bug #1821

closed

Incorrect -0.0.hash

Added by TPReal (Tomasz Błajek) almost 15 years ago. Updated about 13 years ago.

Status:
Closed
Assignee:
-
ruby -v:
ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mswin32]
[ruby-core:24577]

Description

=begin
In the rdoc to Object#hash (http://ruby-doc.org/core/classes/Object.html#M000337) we read: "This function must have the property that a.eql?(b) implies a.hash == b.hash."

The value of -0.0.hash is inconsistent with the above contract:

z=0.0
nz=-0.0
z.eql?(nz) #=> true
z.hash #=> 1041500564
nz.hash #=> -434138511
=end

Actions

Also available in: Atom PDF

Like0
Like0