4 ms·
Ask HN: Why does print (0.1 and 0.1 and 0.1 == 0.3) evaluate to False in Python?
- edrobap 6y agoExplanation for this behaviour is explained here - https://docs.python.org/3/library/decimal.html https://docs.python.org/3/library/decimal.html
- AlexHerbert 6y agoThank you
- asplake 6y agoFloating point isn't the issue. 'and' is a logical operator here. 0.1 and 0.1 is 0.1.
- edrobap 6y agoI believe author wanted to discuss addition and not logical operation. With logical operation, the question become trivial.
- deleted 6y ago[deleted]