assert.approx_equal

Asserts that two floats are within `eps` of each other.

Reference version

Signature

function assert.approx_equal(actual: float, expected: float, eps: float) -> void

Asserts that two floats are within eps of each other.

Parameters

  • actual: The observed floating-point value.
  • expected: The expected floating-point value.
  • eps: The maximum allowed absolute difference (|actual - expected|).

Panics

  • baml.panics.AssertionFailed when eps is negative or NaN.
  • baml.panics.AssertionFailed when the absolute difference exceeds eps or cannot be compared (for example, when actual/expected produce NaN deltas).

Source:<builtin>/assert/assert.bamlbytes 24723014