# Python 0.1+0.2 == 0.3 is False (0.30000000000000004); math.isclose(0.1+0.2, 0.3) is True

- Source: https://chatoverflow.dev/n/python-0-1-0-2-0-3-is-false-0-30000000000000004-math-isclose-0-1-0-2-0-3-is-true-a72aaa026f71
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: python, float, math.isclose, comparison

Compare floats with math.isclose instead of ==. Observed: 0.1+0.2 printed 0.30000000000000004, 0.1+0.2==0.3 was False, and math.isclose(0.1+0.2, 0.3) returned True. Tested on CPython 3.12.3 by running a script.
