Determine GMP version

Paul Zimmermann Paul.Zimmermann at loria.fr
Sun Apr 9 14:04:03 CEST 2006


> From: "Sisyphus" <sisyphus1 at optusnet.com.au>
> Date: Sun, 9 Apr 2006 19:35:09 +1000
> 
> Hi,
> 
> Is there a preprocessor command that will determine the version of the GMP
> library ? This could be useful if we want to use mpz_combit and/or
> mpz_rootrem (which are new in 4.2):
> 
> #ifdef symbolThatSpecifies4.2
> // we can code using mpz_combit and mpz_rootrem
> #else
> // we need to code using a workaround
> #endif
> 
> Cheers,
> Rob

We use the following in MPFR (www.mpfr.org, file root.c for example):

#if !__MPFR_GMP(4,2,0) /* replace rootrem/mpz_root code by faster one */
...
#endif

where __MPFR_GMP is defined in mpfr-impl.h.

Paul Zimmermann





More information about the gmp-discuss mailing list