Ask HN: Why does print (0.1 and 0.1 and 0.1 == 0.3) evaluate to False in Python? 2 points by AlexHerbert 5y ago ↗ HN
[–] edrobap 5y ago ↗ Explanation for this behaviour is explained here - https://docs.python.org/3/library/decimal.html [–] AlexHerbert 5y ago ↗ Thank you [–] asplake 5y ago ↗ Floating point isn't the issue. 'and' is a logical operator here. 0.1 and 0.1 is 0.1. [–] [dead] edrobap 5y ago ↗ I believe author wanted to discuss addition and not logical operation. With logical operation, the question become trivial.
[–] asplake 5y ago ↗ Floating point isn't the issue. 'and' is a logical operator here. 0.1 and 0.1 is 0.1. [–] [dead] edrobap 5y ago ↗ I believe author wanted to discuss addition and not logical operation. With logical operation, the question become trivial.
[–] [dead] edrobap 5y ago ↗ I believe author wanted to discuss addition and not logical operation. With logical operation, the question become trivial.
5 comments
[ 3.3 ms ] story [ 20.3 ms ] thread