Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
Ask HN: Why does print (0.1 and 0.1 and 0.1 == 0.3) evaluate to False in Python?
2 points
AlexHerbert
5y ago
3 comments
Save
Share
3 comments
3 comments · 1 top-level
top
newest
oldest
edrobap
5y ago
· 2 in thread
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.
1 more reply
AlexHerbert
OP
5y ago
Thank you
j
/
k
navigate · click thread line to collapse