[issue36028] Integer Division discrepancy with decimal

Raymond Hettinger report at bugs.python.org
Mon Feb 18 15:35:46 EST 2019


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

I get the same results in both Python 2 and Python 3.

Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 29 2018, 20:59:26) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> 4 / 0.4
10.0
>>> 4 // 0.4
9.0
>>> 4 % 0.4
0.3999999999999998
>>> divmod(4, 0.4)
(9.0, 0.3999999999999998)


Python 3.7.2 (v3.7.2:9a3ffc0492, Dec 24 2018, 02:44:43) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license()" for more information.
>>> 4 / 0.4
10.0
>>> 4 // 0.4
9.0
>>> 4 % 0.4
0.3999999999999998
>>> divmod(4, 0.4)
(9.0, 0.3999999999999998)

----------
nosy: +rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36028>
_______________________________________


More information about the Python-bugs-list mailing list