-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't working
Description
In order to calculate the relative difference between a
and b
, the subtractive difference is divided by a
. This means though that if a
has a 0
value, the result is NaN
or Infinity
.
PowerSystemUtils/src/main/java/edu/ie3/util/quantities/QuantityUtil.java
Lines 143 to 150 in ff7e4da
public static <Q extends Quantity<Q>> boolean isEquivalentRel( | |
Quantity<Q> a, Quantity<Q> b, double relQuantityTolerance) { | |
double aVal = a.getValue().doubleValue(); | |
double bVal = b.to(a.getUnit()).getValue().doubleValue(); | |
return (Math.abs(aVal - bVal) / Math.abs(aVal)) <= relQuantityTolerance; | |
} |
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working