Skip to content

Commit

Permalink
[Fix-426][Metric] fix DiffPercentage calculation rules (datavane#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
xxzuo authored and zixi0825 committed Aug 22, 2024
1 parent 066ebe4 commit 5ef349e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public String getZhName() {
@Override
public BigDecimal getResult(BigDecimal actualValue, BigDecimal expectedValue) {
BigDecimal result = BigDecimal.valueOf(0);
if (expectedValue != null && expectedValue.compareTo(BigDecimal.ZERO) != 0) {
BigDecimal quotient = actualValue.divide(expectedValue, 2, RoundingMode.HALF_UP);
if (expectedValue != null && expectedValue.compareTo(BigDecimal.ZERO) != 0 && actualValue != null) {
BigDecimal quotient = actualValue.subtract(expectedValue).abs();
result = quotient.divide(expectedValue, 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
}

Expand Down

0 comments on commit 5ef349e

Please sign in to comment.