Bug #1454
Updated by shyouhei (Shyouhei Urabe) about 11 years ago
=begin I did the following to produce this error: --------------------------------------------- ruby 1.8 --------------------------------------------- require "rational" require "bigdecimal" a=BigDecimal("3.2") b=Rational(3,4) b/a ---> TypeError: Rational can't be coerced into BigDecimal from /usr/lib/ruby/1.8/rational.rb:206:in `coerce' from /usr/lib/ruby/1.8/rational.rb:206:in `/' from (irb):14 b+a, b-a and b*a yield a similar error a+b, a-b, a*b and a/b work fine. $ irb --version --> irb 0.9.5(05/04/13) $ ruby --version --> ruby 1.8.7 (2008-08-11 patchlevel 72) [i586-linux] --------------------------------------------- jruby 1.2 --------------------------------------------- jruby does seem to have this issue: $ jruby --version --> jruby 1.2.0 (ruby 1.8.6 patchlevel 287) (2009-03-16 rev 9419) [i386-java] $ jirb --version --> irb 0.9.5(05/04/13) [code above in jirb] --> TypeError: Rational can't be coerced into BigDecimal from /usr/local/lib/jruby/lib/ruby/1.8/rational.rb:206:in `/' from (irb):6 --------------------------------------------- ruby 1.9 --------------------------------------------- $ ruby --version --> ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-linux] $ irb --version --> irb 0.9.5(05/04/13) [above code in irb] --> TypeError: BigDecimal can't be coerced into Rational from (irb):5:in `/' from (irb):5 from /usr/local/bin/irb:12:in `<main>' =end