Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

Further to what Matthew said, this is not just a Python oddity. It applies to 
just about all programming languages, including C, C++, Java, Javascript, Ruby, 
etc. Some of them have even less precision by default.

Floats are not the same as the real numbers you learned about in school. There 
is a huge amount of resources about the limitations of floating point 
arithmetic on Stackoverflow etc which can be found by googling. A good place to 
start is the Python FAQs and tutorial:

https://docs.python.org/3/faq/design.html#why-are-floating-point-calculations-so-inaccurate

https://docs.python.org/3/tutorial/floatingpoint.html#tut-fp-issues

----------
nosy: +steven.daprano

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39436>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to