[clean-list] BigInt & GMP on Linux

John van Groningen johnvg at cs.ru.nl
Fri Mar 10 17:21:12 MET 2006


Isaac Gouy wrote:
>What needs to be done to link BigInt & GMP on Linux?
>
>See http://shootout.alioth.debian.org/gp4/benchmark.php?test=pidigits&lang=clean&id=0#log

The ExtendArith library for Clean was created with a modified gmp 2.0.2
library. The source code of this modified gmp library for linux can be
downloaded from the Clean 1.3 libraries download page. However, you probably
want to use a more recent (faster) and unmodified gmp library.

Current gmp libraries are however not compatible with gmp 2.0.2, because
the names of the functions that start with __mpn_ have been renamed, and
now start with __gmpn_. I have modified the ExtendedArith library to
use these new names, and modified the interface so that an unmodified
gmp library can be used.

You can download this library from:

http://www.cs.ru.nl/~clean/download/Clean21/linux/ExtendedArithLinux.tar.gz

See the file README for installation instructions.

This library does not include a gmp library. Instead a gmp library has
to be installed on your linux system first. After installing both
libraries you can compile and link a Clean program like this:

clm -I ExtendedArith -l ExtendedArith/gmp.o -l -lgmp pidigits

The gmp library is linked with "-l -lgmp", because clm passes the argument
after "-l" to the linker, so the linker is called with "-lgmp".

By the way, the example program that was included with ExtendedArith also
computes pi, but in a different way using arctan and is more than 20 times
faster for 2500 digits. (the last digit is however computed incorrectly).

Kind regards,

John van Groningen


More information about the clean-list mailing list