Project

General

Profile

Actions

Bug #13146

closed

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

Added by yxhuvud (Linus Sellberg) about 7 years ago. Updated about 7 years ago.

Status:
Rejected
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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0