Is GMP working properly if it compiles gmp functions w/o errors?

Brian Gladman brg at
Fri Feb 8 18:20:50 CET 2008

Andre Biere wrote:
> Hi everyone,
> I am new to the mailing list, so I hope that someone can read my message and eventually help me. 
> I am currently working on a multiprecision implementation of different algorithms to invert laplace transforms (Whynn Rho, Gaver Stehfest,...). 
> Actually I am quite new to C/C++ and its environments. I chose Windows and Windows Visual Studio, since I am used to work at home with Windows. With the help of installation manuals, i think, i succeeded to build the gmp library. At least, I can include gmp.h and use functions like mpf_add, mpf_sub, etc. w/o errors.
> My question is basicly, if this necessarily means that these function work properly? So far, I have only implemented (+, -, *, /) in the algorithms, but the results seem to be not good enough. E.g. switching from mpf_set_default_prec(50) to mpf_set_default_prec(1000) does not change a lot - and thereafter it stays constant for a precision >1000. Theres a lot of exp, log, factorials and binomial coefficients involved too, that is still computed in double precision. Do you think that the gmp library is working and the main round off problems are in these parts, which could be a reason why the basic arithmetic in gmp does not change too much!?!
> If this is the case, could s.o. please give me a hint how to implement exp, log? I couldnt find sth. about this in the documentation.

You really need two other packages in addition to GMP if you want to 
make your task much easier.  The first, mpfr, is available at:

This provides arithmetic and the common maths functions in multiple 
precision floating point.

And then you need mpfrcpp, which is available at:

This provides a convenient C++ interface for mpfr that allows you to 
treat multiple precision numbers in almost the same way as you would 
treat doubles.

All of these packages (GMP, MPFR and MPFRCPP) can be built and used with 
Microsoft Visual Studio Professional (its possible with Express but a 
bit harder and Express can't build x64 versions).

I use exactly this set of packages to build high precision Chebyshev 
polynomial approximations for special maths functions to hundreds of digits.

Let me know off list if you need any help in getting these packages working.

   best regards,

      Brian Gladman

More information about the gmp-discuss mailing list