-2

int(10000000000000000000000000000000000/10**10) It should return the exact value like 10000000000000000000000, but the returned value is 999999999999999983222784. What is the reason behind it??

1 Answers1

1

The floating point division operator (/) produces an inexact result. Converting it to an int after the fact doesn't fix that.

If you use the integer division operator (//) you get an exact integer result:

>>> 10000000000000000000000000000000000//10**10
1000000000000000000000000
Samwise
  • 68,105
  • 3
  • 30
  • 44