This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients FR4NKESTI3N, Jorge Teran, serhiy.storchaka, steven.daprano
Date 2019-01-06.13:42:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1546782131.37.0.828765896711.issue35672@roundup.psfhosted.org>
In-reply-to
Content
There is no need to call int() on a literal int: 1000003 is already an int, calling int() on it is just wasting time and making confusing code.

print (int(y1y2y3y4))

gives a NameError, since you don't have a variable "y1y2y3y4" defined. Please don't retype your example code from memory, make sure it works and then copy and paste code we can actually run.

I think we can simplify your example to this:

x = 1000112004278059472142857
y = 1000003
print(x/y)
print(int(x/y))


which correctly prints 

1.0001090039510477e+18
1000109003951047619

as the division operator uses floating point division in Python 3. Use the floor-division operator // to duplicate the Python 2 behaviour for ints.

Closing this as not a bug.
History
Date User Action Args
2019-01-06 13:42:12steven.dapranosetrecipients: + steven.daprano, serhiy.storchaka, FR4NKESTI3N, Jorge Teran
2019-01-06 13:42:11steven.dapranosetmessageid: <1546782131.37.0.828765896711.issue35672@roundup.psfhosted.org>
2019-01-06 13:42:11steven.dapranolinkissue35672 messages
2019-01-06 13:42:11steven.dapranocreate