Index: test/test_index =================================================================== --- test/test_index (revision 2628) +++ test/test_index (working copy) @@ -77,6 +77,7 @@ testNoMethodError.rb testCacheMapLeak.rb testPipe.rb +testBigDecimal.rb # MRI Ruby tests (from sample/test.rb in Matz's Ruby Interpreter): Index: src/org/jruby/RubyBigDecimal.java =================================================================== --- src/org/jruby/RubyBigDecimal.java (revision 2628) +++ src/org/jruby/RubyBigDecimal.java (working copy) @@ -12,6 +12,7 @@ * rights and limitations under the License. * * Copyright (C) 2006 Ola Bini + * Copyright (C) 2006 Miguel Covarrubias * * Alternatively, the contents of this file may be used under the terms of * either of the GNU General Public License Version 2 or later (the "GPL"), @@ -140,6 +141,10 @@ } public static RubyBigDecimal newCreate(IRubyObject recv, IRubyObject[] args) { + // MRI wants its first argument to be String-like and will throw a TypeError + // if it does not respond to #to_str (JRUBY-153) + args[0] = args[0].convertToString(); + RubyBigDecimal result = new RubyBigDecimal(recv.getRuntime()); result.callInit(args); return result; @@ -312,7 +317,6 @@ public IRubyObject exponent() { BigDecimal abs = value.abs(); - String unscaled = abs.unscaledValue().toString(); int exponent = abs.toString().indexOf('.'); return getRuntime().newFixnum(exponent); }