Skip to content

Commit

Permalink
Fix rounding logic in Stats (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
brfrn169 authored Dec 14, 2021
1 parent 5d9232e commit 6935511
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/scalar/kelpie/stats/Stats.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.scalar.kelpie.config.Config;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import org.HdrHistogram.ConcurrentHistogram;
Expand Down Expand Up @@ -160,7 +160,7 @@ public String getSummary() {

private double round(double v) {
return new BigDecimal(v)
.round(new MathContext((int) config.getSignificantDigits()))
.setScale((int) config.getSignificantDigits(), RoundingMode.HALF_UP)
.doubleValue();
}

Expand Down

0 comments on commit 6935511

Please sign in to comment.