Hi Thomas,

In a pinch, you can use Zarith and follow each arithmetic operation by a Z.extract or Z.signed_extract operation to normalize the result to the desired range (N-bit unsigned or N-bit signed).  It's not as fast as it could be, but should be reasonably efficient.

- Xavier Leroy



2014-05-20 17:18 GMT+02:00 Thomas Braibant <thomas.braibant@gmail.com>:
Hi list,

I wonder if there is a publicly available library that implements
arbitrary precision (un)signed integers. I could not find anything
relevant with Google, nor on Opam.

By arbitrary, I mean that I want to implement e.g., 43 bits unsigned
arithmetic, and have the right overflow behaviors. I know of zarith
which seems to implement arbitrary precision in the sense that the
precision of the numbers grows as needed.

Best,
Thomas

--
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs