Reflections on mulmod_bnm1

bodrato at bodrato at
Wed Dec 9 11:39:33 CET 2009


>> (And talking about unusual cases, do the current tests exercise
>> borderline cases where inputs or products equal -1,0, or +1 modulo the
>> various B^n ± 1 involved?)
> Yes, it does.

... no, it doesn't... it only tests some borderline cases for the B^n+1 half.

Moreover, the B^n-1 side is known to give a not-normalized result if the
product equals 0.
It returns 0 if and only if one of the two operand was 0.
It returns B^n-1 if both operand are non-zero.

Unfortunately this behaviour is documented only for the reference function
ref_mulmod_bnm1 in tests/mpn/t-mulmod_bnm1.c, and not in the original
mpn/generic/mulmod_bnm1.c file...



More information about the gmp-devel mailing list