From: Karl Brodowsky Date: 2009-05-10T21:32:18+09:00 Subject: [ruby-core:23415] [Bug #1454] compatability of rational and bigdecimal (1.8 and 1.9) Bug #1454: compatability of rational and bigdecimal (1.8 and 1.9) http://redmine.ruby-lang.org/issues/show/1454 Author: Karl Brodowsky Status: Open, Priority: Normal Category: core, Target version: Ruby 1.8.8 ruby -v: ruby 1.8.7 (2008-08-11 patchlevel 72) [i586-linux] 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 `
' ---------------------------------------- http://redmine.ruby-lang.org