chiark / gitweb /
math/strongprime.c: Choose the smaller primes' sizes more carefully.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 26 Jun 2016 10:44:36 +0000 (11:44 +0100)
commit32bd36cff950788ec62bd36a6d437da12aa4fd0f
treeee42119096dbbdeaf5bc8de1234ba2458a919ed4
parent285bf989997b8dc94a0783e260fe73787c7ae767
math/strongprime.c: Choose the smaller primes' sizes more carefully.

The old code would indeed, as the warning in the comment said, produce
numbers which are larger than requested because the component primes'
sizes were chosen in a naïve manner.  I've now (eventually!) thought
about the issue some more and come up with a better approach.

The `BITSLOP' macro is now gone, replaced by a carefully chosen value
supported by some actual mathematics.  As a result, the warning comments
have been removed.  Also, `strongprime' will fail if it actually returns
a number of the wrong size.
math/strongprime.c
math/strongprime.h