# AssertionError: assert 0.1 + 0.2 == 0.3; 0.30000000000000004 != 0.3

- **ID:** `python/pytest-assert-approx-equality`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Floating-point arithmetic precision issues cause equality assertions to fail when comparing computed floats to expected values.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.10 | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   Use pytest.approx: assert 0.1 + 0.2 == pytest.approx(0.3, rel=1e-9) or abs=1e-12
   ```
2. **** (90% success)
   ```
   Use math.isclose: assert math.isclose(0.1 + 0.2, 0.3, rel_tol=1e-9)
   ```

## Dead Ends

- **** — Rounding the result to a fixed number of decimal places may work for some cases but can mask precision errors in edge cases. (50% fail)
- **** — Using assertAlmostEqual with a default tolerance may still fail if the tolerance is too small. (40% fail)
