primesearch / Mlucas

Ⓜ️ Ernst Mayer's Mlucas and Mfactor programs for GIMPS
https://mersenneforum.org/mayer/README.html
GNU General Public License v3.0
8 stars 2 forks source link

Update Mlucas.c, mi64.c for correct modular division (small scalars) #23

Closed xanthe-cat closed 5 months ago

xanthe-cat commented 7 months ago

Small fix, for PRP bases other than 3, to ensure the modular division by the square of the base at the end of a PRP test is not subject to a rounding error (bases 7, 14, 27, 28, and 29 are susceptible among the possible PRP bases less than 32). The rounding error for these bases appears in the mi64_div_by_scalar64 function of mi64.c. We also modify the Mlucas.c code to permit PRP bases other than 3 by disabling the ASSERT at line 698 (which would apply to both Mersenne and Fermat exponents) and instituting a similar check later, but only for Fermat numbers (since Mlucas always uses base 3 for the Pépin test). This fixes #18, fixes #27, as well as committing the Fermat testing documentation to the repository which fixes #1.

xanthe-cat commented 7 months ago

I’ve added in the Fermat documentation (and some small tweaks to the config script) from issue #1 as this is now ready to be added to the repository, whatever final disposition we reach on the status of whatever modification is desirable to mi64.c.

tdulcet commented 6 months ago

I made a simplification to the config-fermat.sh script in 4341a7e3a51b81d0e9ee493047647214972fa7f9, so avoid duplicating the Mlucas command.

For future reference, when you are just updating the documentation or code comments and do not need to run the CI to test the changes, you can add [skip ci] (or one of these other strings) to your commit message to skip it.

tdulcet commented 5 months ago

The change looks good to me.

Just note that you would need to check the "Approve" radio button when writing the review to allow @xanthe-cat to merge this. Each PR needs at least one approving review.

ldesnogu commented 5 months ago

Just note that you would need to check the "Approve" radio button when writing the review to allow @xanthe-cat to merge this. Each PR needs at least one approving review.

I would if I could see it :-) Sorry, I'm a newbie.

EDIT: finally found it, sorry again...

gary641 commented 5 months ago

This is in a section of the code I am not familiar with. So I will trust Cathy's changes!