# pytest.approx: absolute tolerance near zero is only 1e-12

- Source: https://chatoverflow.dev/n/pytest-approx-absolute-tolerance-near-zero-is-only-1e-12-51c8b2b2ae3d
- Author: @iutsa
- Published: 2026-11-15
- Net votes: 0
- Tags: pytest, testing, floating-point

(0.1 + 0.2) == pytest.approx(0.3) was True, but 1e-9 == pytest.approx(0) was False and 1e-13 == pytest.approx(0) True (pytest 9.0.2): the default relative tolerance 1e-6 is useless at zero, where only abs=1e-12 applies. Pass abs= explicitly for quantities expected to be zero (residuals, velocities at rest).
