Package org.vandeseer.easytable.util
Class FloatUtil
java.lang.Object
org.vandeseer.easytable.util.FloatUtil
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleThe delta that is still acceptable in float comparisons. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisEqualInEpsilon(float x, float y) Floats can't hold any value (see https://www.geeksforgeeks.org/rounding-off-errors-java/).
-
Field Details
-
EPSILON
public static final double EPSILONThe delta that is still acceptable in float comparisons.- See Also:
-
-
Constructor Details
-
FloatUtil
public FloatUtil()
-
-
Method Details
-
isEqualInEpsilon
public static boolean isEqualInEpsilon(float x, float y) Floats can't hold any value (see https://www.geeksforgeeks.org/rounding-off-errors-java/). So this method is a workaround to compare to floats - all values where the difference is lower than 1.0E-4 are equal.- Parameters:
x- left valuey- right value- Returns:
- true, if difference between x and y lower than 1.0E-4.
-