Ilya Zakharevich on Sat, 27 Jan 2024 14:35:51 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Big GOTCHAs WITH forprime() — segfault


On Fri, Jan 26, 2024 at 07:08:38PM -0800, Ilya Zakharevich wrote:
> > the "obvious" fix is
> > 
> > -    NEXT_PRIME_VIADIFF(p, d); /* starts at p = 3 */
> > +    NEXT_PRIME_VIADIFF_CHECK(p, d); /* starts at p = 3 */
> > 
> > which leads to
> 
> No, I think this ends the sieving too early (or has a potential to do
> so).  (And adds an extra conditional in the tight loop. — Though this
> may be not THAT important nowadays…)

In another message of today
   http://megrez.math.u-bordeaux.fr/archives/pari-dev-2401/msg00084.html
I introduced another way to correct.

Hope this helps,
Ilya