Skip to content

Commit

Permalink
Change MathContext to 64, as 32 is not enough for some coins
Browse files Browse the repository at this point in the history
  • Loading branch information
romanbsd committed Dec 11, 2023
1 parent 1e2bb2f commit 33f9174
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static BigDecimal roundToStepSize(BigDecimal value, BigDecimal stepSize)

public static BigDecimal roundToStepSize(
BigDecimal value, BigDecimal stepSize, RoundingMode roundingMode) {
BigDecimal divided = value.divide(stepSize, MathContext.DECIMAL32).setScale(0, roundingMode);
return divided.multiply(stepSize, MathContext.DECIMAL32).stripTrailingZeros();
BigDecimal divided = value.divide(stepSize, MathContext.DECIMAL64).setScale(0, roundingMode);
return divided.multiply(stepSize, MathContext.DECIMAL64).stripTrailingZeros();
}
}

0 comments on commit 33f9174

Please sign in to comment.