Class MathUtil


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

      Constructors 
      Modifier Constructor Description
      private MathUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      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 Detail

      • MathUtil

        private MathUtil()
    • Method Detail

      • 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.