int_big_mod.py 433 B

1234567891011121314151617
  1. # test % operation on big integers
  2. delta = 100000000000000000000000000000012345
  3. for i in range(11):
  4. for j in range(11):
  5. x = delta * (i - 5)
  6. y = delta * (j - 5)
  7. if y != 0:
  8. print(x % y)
  9. # these check an edge case on 64-bit machines where two mpz limbs
  10. # are used and the most significant one has the MSB set
  11. x = 0x8000000000000000
  12. print((x + 1) % x)
  13. x = 0x86c60128feff5330
  14. print((x + 1) % x)