Steven D'Aprano <[email protected]> added the comment:
This behaviour is shared by all programming languages that use floating point
numbers. For example, this is Ruby:
[steve@ando ~]$ irb
irb(main):001:0> 10 * 3.14 == 31.4
=> false
irb(main):002:0> 10 * 3.14 - 31.4
=> 3.5527136788005e-15
It's not a bug in Python or even in floating point numbers. See the link in the
tutorial that xtreak gave and the FAQ
https://docs.python.org/3/faq/design.html#why-am-i-getting-strange-results-with-simple-arithmetic-operations
----------
nosy: +steven.daprano
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39749>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com