divappr tests
Paul Zimmermann
Paul.Zimmermann at loria.fr
Tue Dec 15 10:45:06 CET 2009
Hi,
> I think an interface like the following would make sense:
>
> mp_limb_t
> mpn_divappr (mp_ptr qp, mp_size_t qn,
> mp_srcptr_t np, mp_srcptr_t dp, mp_size_t dn);
>
> qn is an input argument, and specifies computing qn quotients limbs
> (plus returned hi word, maybe). Input n is of size qn+1, input d is of
> size dn, 1 <= dn <= qn + 1.
let me say something as a developer of MPFR. Most divisions in MPFR have
inputs and outputs of same precision p, i.e., the significands have the same
number of limbs, say qn.
Requiring the inputs to have qn+1 limbs for n will force us to allocate extra
variables to copy the dividend and padd with one zero limb.
Consider p=53 for example, which correspond to qn=1 on a 64-bit computer.
If mpn_divappr() computes an approximate quotient with nn=dn=1 with say
a maximal error of 2 ulps, in most cases we will be able to deduce the
correct rounding.
Note that in MPFR, both {np, nn} and {dp, dn} are normalized, i.e., their
most significant bit is set.
I therefore ask you to consider a (normalized) input n of qn limbs only
(one might of course have stricter bounds with qn+1).
Paul
More information about the gmp-devel
mailing list