Project

General

Profile

ActionsLike0

Bug #7676

closed

Comparison of Float::NAN in array behaves unexpectedly

Added by simonrussell (Simon Russell) about 12 years ago. Updated over 3 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-linux]
Backport:
[ruby-core:51328]
Tags:

Description

It seems that two arrays containing Float::NAN will be considered equal ([Float::NAN] == [Float::NAN]), despite the fact that Float::NAN != Float::NAN.

Tested and reproduced in 1.8.7p371, 1.9.3p362, 2.0.0preview2. (This bug can be reproduced in Ruby 1.8 as well.) Results below.

1.8.7 p371

1.8.7 :001 > nan = 0.0/0.0
=> NaN
1.8.7 :002 > nan == nan
=> false
1.8.7 :003 > [nan] == [nan]
=> true

1.9.3 p362

1.9.3p362 :001 > Float::NAN == Float::NAN
=> false
1.9.3p362 :002 > [Float::NAN] == [Float::NAN]
=> true

2.0.0 preview2

2.0.0dev :001 > Float::NAN == Float::NAN
=> false
2.0.0dev :002 > [Float::NAN] == [Float::NAN]
=> true


Files

bug-7676.patch (1.67 KB) bug-7676.patch Anonymous, 01/09/2013 11:00 PM

Related issues 1 (0 open1 closed)

Is duplicate of Ruby - Bug #1720: [NaN] == [NaN] が true になるClosedmrkn (Kenta Murata)Actions

Updated by Anonymous about 12 years ago

Updated by ngoto (Naohisa Goto) about 12 years ago

  • Status changed from Open to Rejected

Updated by ngoto (Naohisa Goto) about 12 years ago

  • Category set to doc
  • Status changed from Rejected to Open

Updated by mrkn (Kenta Murata) about 12 years ago

  • Assignee set to matz (Yukihiro Matsumoto)
  • Target version set to 2.6
#11

Updated by jeremyevans0 (Jeremy Evans) over 3 years ago

  • Status changed from Open to Closed
ActionsLike0

Also available in: Atom PDF