@@ -526,7 +526,9 @@ public static RubyBigDecimal newInstance(IRubyObject recv, IRubyObject[] args) {
526
526
MathContext context = MathContext .UNLIMITED ;
527
527
528
528
if (args .length == 2 ) {
529
+ System .err .println ( "margs" + args [1 ]);
529
530
int digits = (int )args [1 ].convertToInteger ().getLongValue ();
531
+ System .err .println ( "margs" + digits );
530
532
if (digits < 0 ) {
531
533
throw runtime .newArgumentError ("argument must be positive" );
532
534
}
@@ -562,6 +564,8 @@ public static RubyBigDecimal newInstance(IRubyObject recv, IRubyObject[] args) {
562
564
return new RubyBigDecimal (runtime , (RubyClass )recv , new BigDecimal (((RubyFixnum )args [0 ]).getLongValue (), context ));
563
565
} else if (args [0 ] instanceof RubyBignum ) {
564
566
return new RubyBigDecimal (runtime , (RubyClass )recv , new BigDecimal (((RubyBignum )args [0 ]).getBigIntegerValue (), context ));
567
+ } else {
568
+ context = MathContext .UNLIMITED ;
565
569
}
566
570
// fall through to String coercion below
567
571
}
@@ -592,7 +596,10 @@ public static RubyBigDecimal newInstance(IRubyObject recv, IRubyObject[] args) {
592
596
strValue = NUMBER_PATTERN .matcher (strValue ).replaceFirst ("$1" );
593
597
594
598
try {
599
+ System .err .println ("newInstance " + strValue );
600
+ System .err .println ("newInstance " + context );
595
601
decimal = new BigDecimal (strValue , context );
602
+ System .err .println ("newInstance " + decimal );
596
603
} catch (NumberFormatException e ) {
597
604
if (isOverflowExceptionMode (runtime )) {
598
605
throw runtime .newFloatDomainError ("exponent overflow" );
@@ -1769,6 +1776,7 @@ public IRubyObject sqrt(IRubyObject arg) {
1769
1776
1770
1777
@ JRubyMethod (name = "to_f" )
1771
1778
public IRubyObject to_f () {
1779
+ System .err .println ("to_f " + value );
1772
1780
if (isNaN ()) {
1773
1781
return RubyFloat .newFloat (getRuntime (), Double .NaN );
1774
1782
}
0 commit comments