# AssertionError: assert 0.1 + 0.2 == 0.3

- **ID:** `python/assertionerror-assert-approx-equal`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Floating-point arithmetic precision issues cause the sum to be slightly off from expected value.

## Version Compatibility

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

## Workarounds

1. **Use pytest.approx for approximate comparison** (95% success)
   ```
   assert 0.1 + 0.2 == pytest.approx(0.3)
   ```
2. **Use math.isclose with tolerance** (90% success)
   ```
   import math; assert math.isclose(0.1 + 0.2, 0.3, rel_tol=1e-9)
   ```

## Dead Ends

- **Using round() on both sides** — round() may still produce different results due to floating-point representation. (60% fail)
- **Multiplying by a factor to avoid decimals** — Does not eliminate the underlying precision issue; may introduce new errors. (40% fail)
