potential bug in the manual
Torbjorn Granlund
tg-this-will-bounce-but-I-am-subscribed-to-the-list-honest at swox.com
Tue Apr 24 18:04:01 CEST 2007
Paul.Zimmermann at loria.fr (Paul Zimmermann) writes:
- Function: mp_limb_t mpn_submul_1 (mp_limb_t *RP, const mp_limb_t
*S1P, mp_size_t N, mp_limb_t S2LIMB)
Multiply {S1P, N} and S2LIMB, and subtract the N least significant
limbs of the product from {RP, N} and write the result to RP.
Return the most significant limb of the product, minus borrow-out
from the subtraction. ^^^^^^^^^^^^^^^^
It seems to me it should be "plus borrow-out from the subtraction" instead.
Indeed, if the N least significant limbs of the product {S1P, N} * S2LIMB are
larger than {RP, N}, then the limb-borrow is C+1, where I denote C the most
significant limb of {S1P, N} * S2LIMB.
You're right. This error has been around since GMP 2.0, i.e., from
when mpn_submul_1 was first documented.
--
Torbjörn
More information about the gmp-bugs
mailing list