Why does python losing precision multiplying two big integers? -
why python losing precision multiplying 2 big integers?
consider these 2 random numbers:
>>> x = 924787625893878964793582 >>> y = 247625893 >>> z = x // y >>> z 3734616015676030 >>> ###so find x, do: z*y, getting wrong result >>> z * y 924787625893878927444790
update:
isn't z * y = x
, if z = x / y
?
why python give me same result 2 different operations:
>>> 924787625893878927444790 // 247625893 3734616015676030 >>> 924787625893878964793582 // 247625893 3734616015676030
you're using integer division, decimal portion truncated. on line 3, use single slash.
Comments
Post a Comment