Why are mpfr, mpc and gmp needed for gcc?

Jose-Marcio Martins da Cruz Jose-Marcio.Martins@mines-paristech.fr
Mon Apr 2 17:46:00 GMT 2012


Jonathan Wakely wrote:

>
> It needs three of them because they do different things.
>
> GCC requires MPFR in order to do floating point calculations are
> compile-time, so that e.g. pow(0.5, 4) can be replaced with a constant
> value instead of calling a function at run-time.  GCC uses MFPR to get
> accurate, platform-independent results that don't depend on the host
> math library, which might be inaccurate or buggy.  MPC is used to do
> similar optimisations for complex numbers.  MPFR requires GMP.

Just curious...

Is there a big difference when using these libraries from system available math library ? Is this 
difference more noticeable in some platforms than in other ones ?

I guess (and I hope) that not all math libraries are inaccurate or buggy, as if this is the case and 
if the compiled program does math calculations using these inaccurate libraries... no need to 
optimize a code which will give inaccurate results.



More information about the Gcc-help mailing list