Package com.google.common.truth
Class MathUtil
java.lang.Object
com.google.common.truth.MathUtil
Math utilities to be shared by numeric subjects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
equalWithinTolerance
(double left, double right, double tolerance) Returns true iffleft
andright
are finite values withintolerance
of each other.static boolean
equalWithinTolerance
(float left, float right, float tolerance) Returns true iffleft
andright
are finite values withintolerance
of each other.static boolean
notEqualWithinTolerance
(double left, double right, double tolerance) Returns true iffleft
andright
are finite values not withintolerance
of each other.static boolean
notEqualWithinTolerance
(float left, float right, float tolerance) Returns true iffleft
andright
are finite values not withintolerance
of each other.
-
Constructor Details
-
MathUtil
private MathUtil()
-
-
Method Details
-
equalWithinTolerance
public static boolean equalWithinTolerance(double left, double right, double tolerance) Returns true iffleft
andright
are finite values withintolerance
of each other. Note that both this method andnotEqualWithinTolerance(double, double, double)
returns false if eitherleft
orright
is infinite or NaN. -
equalWithinTolerance
public static boolean equalWithinTolerance(float left, float right, float tolerance) Returns true iffleft
andright
are finite values withintolerance
of each other. Note that both this method andnotEqualWithinTolerance(double, double, double)
returns false if eitherleft
orright
is infinite or NaN. -
notEqualWithinTolerance
public static boolean notEqualWithinTolerance(double left, double right, double tolerance) Returns true iffleft
andright
are finite values not withintolerance
of each other. Note that both this method andequalWithinTolerance(double, double, double)
returns false if eitherleft
orright
is infinite or NaN. -
notEqualWithinTolerance
public static boolean notEqualWithinTolerance(float left, float right, float tolerance) Returns true iffleft
andright
are finite values not withintolerance
of each other. Note that both this method andequalWithinTolerance(double, double, double)
returns false if eitherleft
orright
is infinite or NaN.
-