Wraparound multiplicaton vs mullo
Torbjorn Granlund
tg at gmplib.org
Sun Oct 18 09:02:53 CEST 2009
nisse at lysator.liu.se (Niels Möller) writes:
Nut it *is* mod 2^n - 1, for certain values of n.
Which values of n?
> Do you represent 0 canonically as B^n-1?
No, it's only "seminormalized", no canonical representation of zero.
I'd expect that B^n - 1 is more likely than zero, since various terms
are added together and then extra high limbs are wrapped around and
added in at the low end.
I don't see how zero can be generated ever in the ref code, except
when multiplying zero. (The mul_2nm1_2 and mul_2nm1_4 functions
are more likely to generate zero, I think.)
The testing code does not seem to think that the two representations of
zero are equal. :-)
--
Torbjörn
More information about the gmp-devel
mailing list