Class MathUtil

java.lang.Object
com.google.common.truth.MathUtil

final class MathUtil extends Object
Math utilities to be shared by numeric subjects.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    equalWithinTolerance(double left, double right, double tolerance)
    Returns true iff left and right are finite values within tolerance of each other.
    static boolean
    equalWithinTolerance(float left, float right, float tolerance)
    Returns true iff left and right are finite values within tolerance of each other.
    static boolean
    notEqualWithinTolerance(double left, double right, double tolerance)
    Returns true iff left and right are finite values not within tolerance of each other.
    static boolean
    notEqualWithinTolerance(float left, float right, float tolerance)
    Returns true iff left and right are finite values not within tolerance of each other.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MathUtil

      private MathUtil()
  • Method Details

    • equalWithinTolerance

      public static boolean equalWithinTolerance(double left, double right, double tolerance)
      Returns true iff left and right are finite values within tolerance of each other. Note that both this method and notEqualWithinTolerance(double, double, double) returns false if either left or right is infinite or NaN.
    • equalWithinTolerance

      public static boolean equalWithinTolerance(float left, float right, float tolerance)
      Returns true iff left and right are finite values within tolerance of each other. Note that both this method and notEqualWithinTolerance(double, double, double) returns false if either left or right is infinite or NaN.
    • notEqualWithinTolerance

      public static boolean notEqualWithinTolerance(double left, double right, double tolerance)
      Returns true iff left and right are finite values not within tolerance of each other. Note that both this method and equalWithinTolerance(double, double, double) returns false if either left or right is infinite or NaN.
    • notEqualWithinTolerance

      public static boolean notEqualWithinTolerance(float left, float right, float tolerance)
      Returns true iff left and right are finite values not within tolerance of each other. Note that both this method and equalWithinTolerance(double, double, double) returns false if either left or right is infinite or NaN.