Project

General

Profile

Backport #2349

lib/bigdecimal: errors in comparisons [patch]

Added by marcandre (Marc-Andre Lafortune) over 10 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:26646]

Description

=begin
$ 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.
=end


Files

bigdec.diff (2.37 KB) bigdec.diff marcandre (Marc-Andre Lafortune), 11/09/2009 03:33 PM

Also available in: Atom PDF