Two calculated values can differ slightly without that difference mattering for the task. Deciding they are “close enough” requires a stated tolerance, not just a convenient number of displayed decimal places.
Separate absolute and relative comparisons. An absolute tolerance describes a fixed difference in the quantity’s units. A relative tolerance scales the allowed difference with the values being compared. Python’s math.isclose documentation explains how its parameters combine these ideas, including the special importance of absolute tolerance near zero.
For an invented check, suppose a data transfer must preserve a value within 0.01 units. A difference of 0.005 meets that stated absolute rule; 0.02 does not. Whether 0.01 is appropriate remains a domain decision, not a conclusion supplied by the function.
Test values just below, at and just above the boundary. Also include zero, negative values where meaningful, and missing or invalid inputs. Record how those exceptional inputs are handled rather than letting them silently count as successful matches.
Keep the original values in the audit result alongside the difference and the rule. Rounding both values before comparison can conceal the very discrepancy being checked. A tolerance is most useful when another person can explain why it was chosen and reproduce its application.
Editorial illustration from the site’s image collection.

