Function mu::tiny::test::approx_equal(double, double, double)

Function Documentation

bool mu::tiny::test::approx_equal(double d1, double d2, double threshold)

Returns true if d1 and d2 differ by at most threshold.

Used by the CHECK_APPROX macro. Handles NaN and infinity correctly.

Parameters:
  • d1 – First value.

  • d2 – Second value.

  • threshold – Maximum allowed absolute difference (must be >= 0).

Returns:

true if |d1 - d2| <= threshold.