Class MathUtils


  • public class MathUtils
    extends java.lang.Object
    small helper class from: https://floating-point-gui.de/errors/NearlyEqualsTest.java
    Author:
    Michael Borgwardt
    • Constructor Summary

      Constructors 
      Constructor Description
      MathUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean nearlyEqual​(double a, double b)  
      static boolean nearlyEqual​(double a, double b, double epsilon)  
      static boolean nearlyEqual​(float a, float b)  
      static boolean nearlyEqual​(float a, float b, float epsilon)  
      static double relativeEpsilon​(double a, double b)  
      static float relativeEpsilon​(float a, float b)  
      • Methods inherited from class java.lang.Object

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

      • MathUtils

        public MathUtils()
    • Method Detail

      • nearlyEqual

        public static boolean nearlyEqual​(double a,
                                          double b)
      • nearlyEqual

        public static boolean nearlyEqual​(double a,
                                          double b,
                                          double epsilon)
      • nearlyEqual

        public static boolean nearlyEqual​(float a,
                                          float b)
      • nearlyEqual

        public static boolean nearlyEqual​(float a,
                                          float b,
                                          float epsilon)
      • relativeEpsilon

        public static double relativeEpsilon​(double a,
                                             double b)
      • relativeEpsilon

        public static float relativeEpsilon​(float a,
                                            float b)