Class FloatUtil

java.lang.Object
org.vandeseer.easytable.util.FloatUtil

public final class FloatUtil extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    The delta that is still acceptable in float comparisons.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    isEqualInEpsilon(float x, float y)
    Floats can't hold any value (see https://www.geeksforgeeks.org/rounding-off-errors-java/).

    Methods inherited from class java.lang.Object

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

    • EPSILON

      public static final double EPSILON
      The 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 value
      y - right value
      Returns:
      true, if difference between x and y lower than 1.0E-4.