Re: Big GOTCHAs WITH forprime( ) — segfault

Ilya Zakharevich <[email protected]> Sat, 27 Jan 2024 05:35:48 -0800
Newsgroups gmane.comp.mathematics.pari.devel
Message-ID <[email protected]>
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