Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d0584dbb3d5c
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ced566605393
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Dec 11, 2014

  1. fix GH-1695 on master

    k77ch7 committed Dec 11, 2014
    Copy the full SHA
    225d626 View commit details

Commits on Jan 12, 2015

  1. Copy the full SHA
    ced5666 View commit details
13 changes: 8 additions & 5 deletions core/src/main/java/org/jruby/ext/bigdecimal/RubyBigDecimal.java
Original file line number Diff line number Diff line change
@@ -437,11 +437,14 @@ private static RubyBigDecimal getVpValue19(ThreadContext context, IRubyObject v,
}

private static RubyBigDecimal getVpRubyObjectWithPrec19Inner(ThreadContext context, RubyRational r) {
long numerator = RubyNumeric.num2long(r.numerator(context));
long denominator = RubyNumeric.num2long(r.denominator(context));

return new RubyBigDecimal(context.runtime,
BigDecimal.valueOf(numerator).divide(BigDecimal.valueOf(denominator), getRoundingMode(context.runtime)));
BigDecimal numerator = BigDecimal.valueOf(RubyNumeric.num2long(r.numerator(context)));
BigDecimal denominator = BigDecimal.valueOf(RubyNumeric.num2long(r.denominator(context)));

int len = numerator.precision() + denominator.precision();
int pow = len / 4;
MathContext mathContext = new MathContext((pow + 1) * 4, getRoundingMode(context.runtime));

return new RubyBigDecimal(context.runtime, numerator.divide(denominator, mathContext));
}

private static RubyBigDecimal getVpValueWithPrec19(ThreadContext context, IRubyObject value, long precision, boolean must) {
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'rational'
require 'bigdecimal'

# https://github.com/jruby/jruby/issues/1695