How to detect integer overflow efficiently?

The Euler package (opam - euler) provides integer arithmetic operations with overflow detection. This said, I’d rather use arbitrary-precision integers with the ZArith package (opam - zarith) : it’s pretty fast for small integers, and gives exact results when integers overflow, which is more useful than raising an exception.

5 Likes