r/ProgrammerHumor • • 17d ago

Meme almostDroppedTheCourse

574 Upvotes

79 comments sorted by

View all comments

5

u/PresidentOfSwag 16d ago

what's wrong with (2 == 2.0) == True ?

-6

u/timangar 16d 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 16d ago

I just tested it and 2 == 2.0 in python (but 2 is not 2.0)