Skip to content

Commit

Permalink
fix: Change to rounding mode half up (school rounding) in LabelWithSi…
Browse files Browse the repository at this point in the history
…gnedNumber
  • Loading branch information
sgcr committed Sep 3, 2024
1 parent 9d5f114 commit 235e764
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/tool/arenasizer/LabelWithSignedNumber.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ private static String formatNumberWithSign(BigDecimal percentage) {
}

public static String percentString(int w, int g) {
return percentageValueString(BigDecimal.valueOf(w).divide(BigDecimal.valueOf(g), 4, RoundingMode.HALF_DOWN));
return percentageValueString(BigDecimal.valueOf(w).divide(BigDecimal.valueOf(g), 4, RoundingMode.HALF_UP));
}

public static String percentageValueString(BigDecimal percentage) {
final BigDecimal percent = percentage
.multiply(BigDecimal.valueOf(100))
.setScale(1, RoundingMode.HALF_DOWN);
.setScale(1, RoundingMode.HALF_UP);
return String.format("%s %%", percent);
}
}

0 comments on commit 235e764

Please sign in to comment.