Bug #2349: lib/bigdecimal: errors in comparisons [patch]
http://redmine.ruby-lang.org/issues/show/2349

Author: Marc-Andre Lafortune
Status: Open, Priority: Normal
Assigned to: Marc-Andre Lafortune, Category: ext, Target version: 1.9.2
ruby -v: all

$ ruby -r bigdecimal -e 'p BigDecimal.new("1") < nil'
nil

expected: an error like with any other mathematical type:
-e:1:in `<': comparison of BigDecimal with nil failed (ArgumentError)

--------------
$ ruby -r bigdecimal -e 'p BigDecimal.new("1") == nil'
nil

expected: false like with any other Ruby object

--------------
$ ruby -r bigdecimal -e 'p BigDecimal.new("NaN") < 1'
nil

expected: false, like with any other mathematical comparison


I'll commit the attached patch in a few days (for 1.8 & 1.9) unless there are arguments against it.


----------------------------------------
http://redmine.ruby-lang.org