Simple question about MPFR vs. GMP

Elias P. TSIGARIDAS et at di.uoa.gr
Sun Apr 9 14:54:50 CEST 2006


Hello to all,
Even though I do not have much experience,
please allow me to express my opinion about this issue.

At the current state GMP provides operations on rationals and integers,
thus in Z and Q.
It is well known that Z \subset Q \subset R

What we actually want is to compute in R, but this is impossible
since we can not represent all the real numbers.
(Actually many things are undecidable here, but I will not go into details)
What we do is a compromise, we work with "some" real numbers, that are
represented in a very efficient representation (floating point) and that
is the work of MPFR.

Let me state an example:
If you work in mpz the sqrt(2)=1.
while when you work in mpfr  sqrt( 2) = 1.414213562...
and the digits that you get after the decimal point can be defined by
the user, with some guarantee (this is where correct rounding appears).

with best regards,

--Elias

Linas Vepstas wrote:
> 
> Hi,
> 
> I have a rather naive question about MPFR vs. GMP that
> I could not resolve by reviewing the MPFR web page. That
> question is this:
> 
>   Exactly HOW is MPFR better than GMP? Why, as a programmer,
>   should I care about exact rounding?
> 
> If I'm writing a program to compute some function to 400
> decimal places, I have to do a fair bit of logic and thinking
> to make sure I actually obtained 400 bits of accuracy. A bit
> of rounding error here and there doesn't substantially change
> my eror estimates .. and so, why should I care about "exact 
> rounding"?
> 
> --linas
> 
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at swox.com
> https://gmplib.org/mailman/listinfo/gmp-discuss
> 



More information about the gmp-discuss mailing list