Why does python think that 0.1 plus 0.2 is ~0.3000000000004 /u/HoskinZo Python Education

I’m new to python and really enjoying it so far!

I’m reading Eric Matthes’ Python Crash Course to learn–there’s a section on floats and basic math and it shows that if you input answer = 0.1 + 0.2 and then print(answer), it gives you the answer of 0.30000000004 (possibly with more or less zeroes before the 4).

It’s okay but I’m just curious why python does this? Does anyone know the behind-the-scenes of how it computes this?

submitted by /u/HoskinZo
[link] [comments]

​r/learnpython I’m new to python and really enjoying it so far! I’m reading Eric Matthes’ Python Crash Course to learn–there’s a section on floats and basic math and it shows that if you input answer = 0.1 + 0.2 and then print(answer), it gives you the answer of 0.30000000004 (possibly with more or less zeroes before the 4). It’s okay but I’m just curious why python does this? Does anyone know the behind-the-scenes of how it computes this? submitted by /u/HoskinZo [link] [comments] 

I’m new to python and really enjoying it so far!

I’m reading Eric Matthes’ Python Crash Course to learn–there’s a section on floats and basic math and it shows that if you input answer = 0.1 + 0.2 and then print(answer), it gives you the answer of 0.30000000004 (possibly with more or less zeroes before the 4).

It’s okay but I’m just curious why python does this? Does anyone know the behind-the-scenes of how it computes this?

submitted by /u/HoskinZo
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *