Skip to content

Commit

Permalink
Merge pull request #4256 from jruby/revert-4159-sprintf_rounding
Browse files Browse the repository at this point in the history
Revert "Format initial string to specific precision, so rounding works."
  • Loading branch information
headius committed Oct 30, 2016
2 parents 35f4547 + 06bd7f5 commit a05168b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions core/src/main/java/org/jruby/util/Sprintf.java
Expand Up @@ -864,12 +864,8 @@ else if ((flags & FLAG_MINUS) != 0) {
break;
}

if ((flags & FLAG_PRECISION) == 0) {
precision = 6;
}

NumberFormat nf = getNumberFormat(args.locale);
nf.setMaximumFractionDigits(precision);
nf.setMaximumFractionDigits(Integer.MAX_VALUE);
String str = nf.format(dval);

// grrr, arghh, want to subclass sun.misc.FloatingDecimal, but can't,
Expand Down Expand Up @@ -967,6 +963,9 @@ else if ((flags & FLAG_MINUS) != 0) {
} else {
signChar = 0;
}
if ((flags & FLAG_PRECISION) == 0) {
precision = 6;
}

switch(fchar) {
case 'E':
Expand Down

0 comments on commit a05168b

Please sign in to comment.