The Zarith library implements arithmetic and logical operations over arbitrary-precision integers and rational numbers. The implementation, based on GMP, is very efficient.
Browse cluster: OCaml Systems and Utilities →Zarith is a library for OCaml that implements arithmetic and logical operations over arbitrary-precision integers and rational numbers. Built on top of GMP (the GNU Multiple Precision arithmetic library), it optimizes performance by representing small integers as unboxed Caml integers while using GMP's low-level functions for larger values, with allocations managed through the Caml heap for better garbage collection. The library was developed by Antoine Miné at Sorbonne Université (formerly ENS Paris), Xavier Leroy at Collège de France (formerly Inria Paris), Pascal Cuoq at TrustInSoft, and Christophe Troestler, with the core work originating from the Abstraction project at LIENS.