Re: efficiency bug in mpz_powm_ui?

2020-02-29 Thread Marco Bodrato
Ciao, Il 2020-02-29 11:54 paul zimmermann ha scritto: it seems that mpz_powm_ui is highly inefficient when BASE^EXP has about the same size as MOD, in which case it could first compute BASE^EXP exactly, then perform only one reduction: You are right, mpz_powm_ui does not implement an algorit

efficiency bug in mpz_powm_ui?

2020-02-29 Thread paul zimmermann
Hi, it seems that mpz_powm_ui is highly inefficient when BASE^EXP has about the same size as MOD, in which case it could first compute BASE^EXP exactly, then perform only one reduction: zimmerma@tomate:/tmp$ ./a.out 10 GMP version: 6.2.0 mpz_ui_pow_ui+mpz_mod took 100ms set_ui+mpz_powm