[Bug #2661] Bignum <= BigDecimal("NaN") raises an Exception

Bug #2661: Bignum <= BigDecimal(“NaN”) raises an Exception
http://redmine.ruby-lang.org/issues/show/2661

e$B5/I<<Te(B: Yusuke E.
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
e$B%+%F%4%je(B: core
ruby -v: ruby 1.9.2dev (2010-01-27 trunk 26434) [i686-linux]

e$B1sF#$G$9!#e(B

Bignum e$B$He(B BigDecimal(“NaN”) e$B$re(B <=
e$B$J$I$GHf3S$9$k$HNc30$,$"$,$j$^$9!#e(B

$ ./ruby -rbigdecimal -ve ‘p 2**100 <= BigDecimal(“NaN”)’
ruby 1.9.2dev (2010-01-27 trunk 26434) [i686-linux]
-e:1:in <=': comparison of Bignum with BigDecimal failed (ArgumentError) from -e:1:in

e$B$6$C$H3NG’$7$?8B$j$G!"e(B1.8.6-p388 e$B!"e(B1.8.7-p249
e$B!"e(B1.9.1-p378 e$B!"e(Btrunk e$B$N$$$:$le(B
e$B$G$bH/@8$7$^$9!#e(B

Comparable#<= e$B$,F0$-!"$=$NCf$Ge(B coerce e$B$He(B <=>
e$B$,8F$P$l$^$9$,!"e(BNaN e$B$H$Ne(B <=> e$B$Oe(B
nil e$B$,JV$k$?$a!"e(BComparable#<= e$B$,2;$r>e$2$^$9!#e(B

Fixnum#<= e$B$N>l9g$O!"e(Bcoerce [email protected]!"e(Bcoerce
e$B$N7k2L$KBP$7$Fe(B <= e$B$r8F$V$N$Ge(B
e$BNc30$K$O$J$j$^$;$s!#e(B

Fixnum e$B$HF1MM$Ke(B Bignum#<=, <, >= >
e$B$r<BAu$7$J$$$HBP=h$G$-$J$$$h$&$J5$$,e(B
e$B$7$^$9!#e(B

e$BNc$K$h$C$F!"e(Brubyspec e$B$,$3$l$GMn$A$F$$$^$9!#e(B

BigDecimal#<= properly handles NaN values ERROR
ArgumentError: comparison of Bignum with BigDecimal failed
/home/mame/work/ruby/spec/rubyspec/library/bigdecimal/lte_spec.rb:77:in
<=' /home/mame/work/ruby/spec/rubyspec/library/bigdecimal/lte_spec.rb:77:inblock (4 levels) in <top (required)>’
/home/mame/work/ruby/spec/rubyspec/library/bigdecimal/lte_spec.rb:74:in
each' /home/mame/work/ruby/spec/rubyspec/library/bigdecimal/lte_spec.rb:74:inblock (3 levels) in <top (required)>’
/home/mame/work/ruby/spec/rubyspec/library/bigdecimal/lte_spec.rb:4:in
`<top (required)>’


Yusuke E. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs