[issue36028] Integer Division discrepancy with decimal

2019-02-18 Thread Tim Peters
Tim Peters added the comment: "Multiple roundings" in the float code is a red herring - that's just implementation details trying to cheaply get the same effect as computing with infinite precision. Here with actual unbounded precision: >>> from fractions import Fraction >>> y = Fraction(0.

[issue36028] Integer Division discrepancy with decimal

2019-02-18 Thread Raymond Hettinger
Raymond Hettinger added the comment: I'm thinking this due to having two different algorithms in play, one of which has multiple intermediate roundings. * For starters, 0.4 is not exactly representable. It is stored as the binary fraction 3602879701896397 / 9007199254740992 represented in he

[issue36028] Integer Division discrepancy with decimal

2019-02-18 Thread Rémi Lapeyre
Change by Rémi Lapeyre : -- nosy: +remi.lapeyre ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue36028] Integer Division discrepancy with decimal

2019-02-18 Thread Raymond Hettinger
Raymond Hettinger 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

[issue36028] Integer Division discrepancy with decimal

2019-02-18 Thread Au Vo
New submission from Au Vo : In Python3, there is a discrepancy of integer division with decimal. Considering these two examples: 4/ .4 ==10.0. But 4//.4== 9.0 Furthermore: 2//.2 == 9.0 3//.3 ==10.0 5//.5 ==10.0 6//.6 ==10.0 All answers should be 10.0? The problem is in Python3 and not in Py