Decimal compare #141920
Answered
by
MuxN4
UsboKirishima
asked this question in
Code Security
Decimal compare
#141920
-
Select Topic AreaShow & Tell BodyMany people thinks that 0.1 + 0.2 = 0.3 but if you try to compare this in python if 0.1 + 0.2 == 0.3: print('yes') else: print('no')``` |
Beta Was this translation helpful? Give feedback.
Answered by
MuxN4
Oct 18, 2024
Replies: 4 comments 1 reply
-
@UsboKirishima I'd say its a consequence of how floating-point numbers are represented in binary |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
UsboKirishima
-
Nanobotsnotbits |
Beta Was this translation helpful? Give feedback.
0 replies
-
Nanobots |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@UsboKirishima I'd say its a consequence of how floating-point numbers are represented in binary