3
0

arith-bignum1.tests 767 B

1234567891011121314151617
  1. exec 2>&1
  2. # If the number does not fit in 64 bits, bash uses truncated 64-bit value
  3. # (essentially, it does not check for overflow in "n = n * base + digit"
  4. # calculation).
  5. echo 18 digits: $((999999999999999999))
  6. echo 19 digits: $((9999999999999999999))
  7. echo 20 digits: $((99999999999999999999))
  8. echo 18 digits- $((-999999999999999999))
  9. echo 19 digits- $((-9999999999999999999))
  10. echo 20 digits- $((-99999999999999999999))
  11. echo "Hex base#:"
  12. printf '16 digits: %016x\n' $((16#9876543210abcedf))
  13. printf '17 digits: %016x\n' $((16#9876543210abcedfc))
  14. printf '18 digits: %016x\n' $((16#9876543210abcedfcc))
  15. printf '16 digits: %016x\n' $((-16#9876543210abcedf))
  16. printf '17 digits: %016x\n' $((-16#9876543210abcedfc))
  17. printf '18 digits: %016x\n' $((-16#9876543210abcedfcc))