MLGMPIDL

MLGMPIDL is a package offering an interface to the GMP and MPFR libraries for OCaml version 3.07 or higher. The interface offers access to almost all the functions of the library, and is decomposed into 7 submodules, corresponding to C modules:

Mpz GMP integers, with side-effect semantics (as in C library) Mpq GMP rationals, with side-effect semantics (as in C library) Mpzf GMP integers, with functional semantics Mpqf GMP rationals, with functional semantics Mpf GMP multiprecision floating-point numbers Gmp_random GMP random number functions Mpfr MPFR multiprecision floating-point numbers, with side-effect semantics (as in C library) Mpfrf MPFR multiprecision floating-point numbers, with functional semantics

There already exist such an interface, MLGMP, written by D. Monniaux and available here. The motivation for writing a new one were:

The fact that MLGMP provides by default a functional interface to GMP, potentially more costly in term of memory allocation than an imperative interface. MLGMP provides only a relative small numbers of functions in an imperative version. The compatibility with the CAMLIDL tool. MLGMPIDL uses CAMLIDL, so that other OCaml/C interfaces written with CAMLIDL may reuse the MLGMPIDL .idl files.

LGPL