[MPFR] Re: convert mpf t to double with rounding-modes defined by ieee754
Patrick Pelissier
Patrick.Pelissier at loria.fr
Tue Aug 2 09:49:49 CEST 2005
> PP> Which functions did you use?
> PP> What do you mean by "MPFR doesn't fit my problem"?
>
> PP> In my own benchs, MPFR is as fast as MPF. It evens beat MPF in some.
>
> I generate three mpf(r)_t variables, do some 'random' operations on them and
> read out the interval time counter of my Itanium2. Then I compare the average
> computation time for the three blocks: initializations, set doubles and the
> multiplications/additions.
>
> The initialization is quite identically fast (about 727 clocks), the setting
> of the double-values is about 94 (mpfr) to 1059 (gmp) clocks and the
> operations about 1430 to 5600.
Hello,
I have found what's wrong with MPFR (or what's wrong with MPF ;).
MPF uses a scheme where the number of limbs actually present can
be less than the selected precision, thereby allowing low precision
values (for instance small integers) to be stored and manipulated in
an mpf_t efficiently.
MPFR doesn't have such a feature.
In your test case, you never reach the maximum precision for z:
410 bits of precision for z is enought to compute exactly. So MPF
intenal precision never exeeds 410 bits.
The problem is for the multiplication z * x:
MPFR performs a full multiplication 4288x64
whereas MPF does a smaller multiplication (like 300x64) since
the actual precision of z is smaller than 4288 (around 400).
If you select a precision of 500 for z, the difference between MPFR & MPF
becomes much more reasonable; whereas if you select bigger precision, it
increases a lot. If you look at MPF's times, you can see that they don't
increase at all when you increase the precision of z.
--
Patrick Pelissier
More information about the gmp-discuss
mailing list