Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] OCaml and bignums
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-05-10 (04:41)
From: Michel Quercia <michel.quercia@p...>
Subject: Re: [Caml-list] OCaml and bignums
le Sun, 09 May 2004 23:06:52 +0200, Roberto Bagnara <> écrivit :

> I have made a web search to understand which kind of
> support for bignums is available for OCaml.
> I must say that I am rather confused: it is not clear
> to me which packages are still maintained and which
> are dead, which ones are more widely used, and what
> are the relative merits of the various proposals.
> I would appreciate it very much if someone could
> put me on the right track.
> All the best,

To my knowledge, there are 3 bignum packages available for Ocaml :

1. The Bignum library shipped within the standard Ocaml distribution and maintained by the INRIA team. It provides support for big integers and for rationnals.

2. MLGMP : bindings for the GNU Multiprecision library, maintained by David Monniaux ( It provides support for big integers, for rationnals and for big precision floats.

3. Numerix : another multiprecision library maintained by me ( It provides support for big integers only, on x86/Unix platforms.

I have no idea on how widely each package is used.

Relative merits :

-- Bignum is standard and portable. It should be the best choice for "small bigints" (up to a few words long). The algorithms have a quadratic complexity, and are not suitable for hudge bigints.

-- MLGMP has the merits of GMP : portable and very fast (quadratic and subquadratic algorithms depending on the sizes of the inputs). The only drawback is a possibility to exhaust memory in long computations due to the use of two separate GC (the one of Ocaml and the one of GMP).

-- Numerix is my baby, so I'll let other users say if it has merits. Same scheme as GMP (choose a suitable algorithm depending on the sizes of the inputs), without the double-GC problem. The drawback is portability : works on x86/Linux.

Michel Quercia
23 rue de Montchapet, 21000 Dijon (maths) (informatique)

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: