Message333112
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. |
|
Date |
User |
Action |
Args |
2019-01-06 13:42:12 | steven.daprano | set | recipients:
+ steven.daprano, serhiy.storchaka, FR4NKESTI3N, Jorge Teran |
2019-01-06 13:42:11 | steven.daprano | set | messageid: <1546782131.37.0.828765896711.issue35672@roundup.psfhosted.org> |
2019-01-06 13:42:11 | steven.daprano | link | issue35672 messages |
2019-01-06 13:42:11 | steven.daprano | create | |
|