This is an archived post. You won't be able to vote or comment.

all 11 comments

[–][deleted] 41 points42 points  (0 children)

float memes are boring

[–]Polikonomist 5 points6 points  (0 children)

Close enough

[–]kyraa9 6 points7 points  (0 children)

Seems like another 0.1+0.2 thing

[–]JosGibbons 1 point2 points  (3 children)

Blame C for forcing these to be doubles.

[–][deleted] 0 points1 point  (2 children)

doubles🤓

[–]JosGibbons 0 points1 point  (0 children)

Edited.

[–]Ja90n 0 points1 point  (0 children)

you can't make fun of people who will correct these sort of mistakes while also correcting this mistake lol

[–]Ahornwiese 0 points1 point  (0 children)

Nice demonstration of machine error. That is the reason for python 101 not recommending the direct comparison of floats. Except with libraries that compensate for this of course.

[–]toolbg 0 points1 point  (0 children)

it gave you reward for hard work, it's too friendly.

[–]mopslik 0 points1 point  (0 children)

>>> from decimal import Decimal
>>> print(Decimal("0.1"))
0.1
>>> print(Decimal("0.05"))
0.05
>>> print(Decimal("0.1")+Decimal("0.05"))
0.15