Hacker News new | ask | show | jobs
by masklinn 4584 days ago
> Python has a long integer type which won't over/underflow unless you run out of memory.

IIRC, so do Erlang, Ruby or Haskell (when using `Integer`), FWIW. And Java has BigInteger (though that one's a pain to use).

But there's a cost to their existence (they need to check for overflow at every operation), and a cost to going above machine word size. Also, now you've got "integers" which can take arbitrary amounts of memory and integer operations in O(n)

Still, definitely a plus on the correctness side.

There's also the option of type-encoded value ranges as in Pascal or Ada.