Quick question about PP and PP_INVERTED defines

Marco Bodrato bodrato at mail.dm.unipi.it
Sun Jun 19 15:32:24 CEST 2022


Ciao Brett,

Il 2022-06-19 03:26 Brett Kuntz ha scritto:
> "Fast Primality Testing for Integers That Fit into a Machine Word -
> Michal Foriˇsek and Jakub Janˇcina"

For sure it's possible to write special functions for numbers that "fit 
into a machine word". This is not the main goal of GMP, but it might be 
interesting.

> as both functions use isprime. That may
> lead to a small improvement.
> 
> For this line:
> 
> ln2 = mpz_sizeinbase (n, 2);	/* FIXME: tune this limit */

> For large inputs (32 million bits) this test will loop millions of

Torbjorn wrote me some months ago, about isprime.

I attach a patch I wrote.
It might help to address some of the issue you are speaking about.
But I did not test it enough...

If you want to try it, you need a current snapshot of the development 
code.


Ĝis,
m
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pprime.patch
Type: text/x-diff
Size: 1334 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-discuss/attachments/20220619/dddccaca/attachment.bin>


More information about the gmp-discuss mailing list