Re: Pseudo prime tests

2012-06-14 Thread Torbjorn Granlund
bodr...@mail.dm.unipi.it writes: You mean the BPSW primality test? I wasn't aware of this BPSW suggestion. What I am suggesting is similar, but I am not familiar with the Lucas test. I also think one should do more trial dividing, and let its limits be operand dependent. Some months ago,

Re: Pseudo prime tests

2012-06-14 Thread bodrato
Ciao, Il Gio, 14 Giugno 2012 2:41 pm, Torbjorn Granlund ha scritto: bodr...@mail.dm.unipi.it writes: I wrote a kind of implementation for the Lucas-Selfridge test, it Cool. I suppose I need to read more about the maths to fully admire your work. :-) I plainly implemented the formulas

Re: Generalizing Montgomery mod algorithm

2012-06-14 Thread Niels Möller
Torbjorn Granlund t...@gmplib.org writes: I agree this method could make a faster SB mpn_tdiv_r, but I am unconvinced that you can get the quotient with fewer operatons than the current code. The method specialized for div_qr_1 did beat the udiv_qrnnd_preinv loop (at least when comparing the

mpn_sizeinbase

2012-06-14 Thread bodrato
Ciao! 1) mpz/generic/sizeinbase.c is unused. Should we remove it? Or, at least, write it as: size_t mpn_sizeinbase (mp_srcptr xp, mp_size_t xsize, int base) { size_t result; MPN_SIZEINBASE (result, xp, xsize, base); return result; } 2) gmp-impl.h defines the unused macro

Re: mpn_sizeinbase

2012-06-14 Thread Niels Möller
bodr...@mail.dm.unipi.it writes: 1) mpz/generic/sizeinbase.c is unused. s/mpz/mpn/, right? Should we remove it? Or, at least, write it as: size_t mpn_sizeinbase (mp_srcptr xp, mp_size_t xsize, int base) { size_t result; MPN_SIZEINBASE (result, xp, xsize, base); return result; }

Re: mpn_sizeinbase

2012-06-14 Thread Niels Möller
bodr...@mail.dm.unipi.it writes: About documentation... shall we explicitly document a supported way to obtain an mpn form an mpz, and viceversa? The following should always work, right? /* {np, nn} - |z| */ mpz_export (np, nn, -1, sizeof(mp_limb_t), 0, sizeof(mp_limb_t) * 8 -