r/coding • u/donutloop • Oct 20 '26
Add 0.1 ten times in Python and you miss 1.0
https://youtube.com/shorts/RPA5NYTo3FQ?is=ZYoQHYOkUO_0ke6R
0
Upvotes
r/coding • u/donutloop • Oct 20 '26
2
u/synept Oct 21 '26
This isn't a Python thing, it's a computer thing. Don't compare floats directly with ==.
Use the Decimal module if you want different behavior.