Project

General

Profile

Bug #13146

Float::NANs in Hashes are confusing (more than usual).

Added by yxhuvud (Linus Sellberg) over 3 years ago. Updated over 3 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.1p112
[ruby-core:79217]

Description

test = {Float::NAN => 1, -Float::NAN => 2}
=> {NaN=>1, NaN=>2}

test.values_at(Float::NAN, -Float::NAN)
=> [1, nil]

I don't know what the correct behaviour ought to be, but it seems inconsistent to create a hash with two elements but not be able to extract both values.

Also available in: Atom PDF