Interface FloatingPointTolerance

All Known Implementing Classes:
AbsoluteErrorBound, ExactTolerance, RelativeErrorBound, UlpDistanceBound

public interface FloatingPointTolerance
Represents allowable error bounds for comparing the equality of two floating point numbers.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    A tolerance requiring exact value equivalence.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isWithinTolerance(double value1, double value2)
    Indicates whether the specified values are equal under the tolerance.
    boolean
    isWithinTolerance(float value1, float value2)
    Indicates whether the specified values are equal under the tolerance.
    boolean
    Indicates whether the specified values are equal under the tolerance.
  • Field Details

  • Method Details

    • isWithinTolerance

      boolean isWithinTolerance(float value1, float value2)
      Indicates whether the specified values are equal under the tolerance.
      Parameters:
      value1 - the first value to compare
      value2 - the second value to compare
      Returns:
      true if the two values lie with the error bounds, otherwise false
    • isWithinTolerance

      boolean isWithinTolerance(double value1, double value2)
      Indicates whether the specified values are equal under the tolerance.
      Parameters:
      value1 - the first value to compare
      value2 - the second value to compare
      Returns:
      true if the two values lie with the error bounds, otherwise false
    • isWithinTolerance

      boolean isWithinTolerance(BigDecimal value1, BigDecimal value2)
      Indicates whether the specified values are equal under the tolerance.
      Parameters:
      value1 - the first value to compare
      value2 - the second value to compare
      Returns:
      true if the two values lie with the error bounds, otherwise false