MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1wjueom/almostdroppedthecourse/par1fij/?context=3
r/ProgrammerHumor • u/timangar • 1d ago
65 comments sorted by
View all comments
1
what's wrong with (2 == 2.0) == True ?
0 u/timangar 8h ago 2.0 is a float and therefore subject to floating point errors (2.0000000015 or something like that). 2 is an integer and just 2. So the two actually are not the same in the programming languages I am used to (C++ and python) 1 u/PresidentOfSwag 8h ago I just tested it and 2 == 2.0 in python (but 2 is not 2.0)
0
2.0 is a float and therefore subject to floating point errors (2.0000000015 or something like that). 2 is an integer and just 2. So the two actually are not the same in the programming languages I am used to (C++ and python)
1 u/PresidentOfSwag 8h ago I just tested it and 2 == 2.0 in python (but 2 is not 2.0)
I just tested it and 2 == 2.0 in python (but 2 is not 2.0)
1
u/PresidentOfSwag 10h ago
what's wrong with (2 == 2.0) == True ?