approx_equal

approx_equal(x: float, y: float, tol: float = 1e-15) bool[source]

Return True if two numbers are equal within the given tolerance.

This utility function returns True if two numbers are equal within the given tolerance.

Examples: >>> approx_equal(1.0e-2, 1.2e-2, 1e-2) True >>> approx_equal(1.0e-2, 1.2e-2, 1e-3) False