Function tap::algorithms::compareFloatClose

Function Documentation

inline bool tap::algorithms::compareFloatClose(float val1, float val2, float epsilon)

Use this instead of the == operator when asserting equality for floats. Performs

fabsf(val1-val2)<=epsilon

Parameters:
  • val1[in] the first value to compare.

  • val2[in] the second value to compare.

  • epsilon[in] the floating point equality tolerance, for equality a recommended epsilon is 1E-6, though any small epsilon will do.

Returns:

true if val1 and val2 are equal within some epsilon tolerance, false otherwise.