"Marco Bodrato" <bodr...@mail.dm.unipi.it> writes: > The problem is that Niels' code, mine, and the current mpz code... do all > "reduce" modulo (2^19937-20023) obtaining some non-canonical > representation.
I was thinking that one should convert to canonical representation at the end of the powering. But if the current code doesn't do that, staying compatible would need extra care. And it rules out the simple way of just using mpn_powm. (And then I realized that one has to produce a canonical representation also for the initial reduction, since that uses a different modulo, p-4). > If we "do not want to generate different sequences than earlier GMP", we > will have to mimic current behaviour, even in the corner cases... I think that should be doable, if we want to. Without thinking too deeply about it, it looks like your variant with shift should be equivalent to the current mpz code, maybe mine too (it essentially combines the shift with the addmul_1 call). > Is it worth doing? I think it's desirable to eliminate the dependency on mpz. How important it is not change the seed --> sequence mapping, I don't know. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. _______________________________________________ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel