mpn_tdiv_q
Torbjörn Granlund
tg at gmplib.org
Wed Dec 10 08:34:37 UTC 2014
Fredrik Johansson <fredrik.johansson at gmail.com> writes:
I suggest adding a public mpn function
mpn_tdiv_q(mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t)
that computes a correctly rounded truncated quotient, disallowing aliasing.
Isn't "correctly rounded truncated quotient" an oxymoron?
This could simply be implemented using TMP_ALLOC_LIMBS + mpn_div_q
(possibly with a special case for mpn_divrem_1).
For good reasons, we're making allocation visible to users, so this
suggested function would be a step back.
An mpn_tdiv_q function would provide a stable and obvious division
interface without either of those drawbacks. It could be added
independently of other potential changes such as changing the amount
of temp space required by mpn_div_q (or removing this parameter
entirely, effectively making mpn_div_q/mpn_tdiv_q aliases for the same
thing).
Well, if you assume function A has a stable interface and function B has
not, then of course A is preferrable. :-)
But the GMP hackers carefully maintain compatibility within a documented
set of functions.
I'm afraid I vote against your proposal since I think GMP's current
direction wrt mpn division is better. (We should however declare a
handful more function as public, though.)
Torbjörn
Please encrypt, key id 0xC8601622
More information about the gmp-devel
mailing list