Define CHECK_APPROX

Define Documentation

CHECK_APPROX(expected, actual, threshold)
[source]

Fail if expected and actual differ by more than threshold.

Accepts any numeric type (floating-point or integral); all three operands must share the same type so mismatched pairs produce a compiler diagnostic. Handles NaN correctly: a NaN operand always fails the check.

See also

CHECK_APPROX_TEXT, approx_equal

Parameters:
  • expected – Expected value.

  • actual – Actual value.

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