Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Ask HN: Why does print (0.1 and 0.1 and 0.1 == 0.3) evaluate to False in Python? | Better HN
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 · 3 comments
Comments
[–]
edrobap
5y ago
Explanation for this behaviour is explained here -
https://docs.python.org/3/library/decimal.html
[–]
asplake
5y ago
Floating point isn't the issue. 'and' is a logical operator here. 0.1 and 0.1 is 0.1.
[–]
AlexHerbert
OP
5y ago
Thank you