@@ -491,7 +491,8 @@ cdef class Pari(Pari_auto):
491
491
492
492
# Take 1MB as minimal stack. Use maxprime=0, which PARI will
493
493
# internally increase to some small value like 65537.
494
- pari_init_opts(1000000 , 0 , INIT_DFTm)
494
+ # (see function initprimes in src/language/forprime.c)
495
+ pari_init_opts(1000000 * sizeof(long ), 0 , INIT_DFTm)
495
496
after_resize()
496
497
497
498
# Disable PARI's stack overflow checking which is incompatible
@@ -557,7 +558,7 @@ cdef class Pari(Pari_auto):
557
558
558
559
When the PARI system is already initialized, the PARI stack is only
559
560
grown if ``size`` is greater than the current stack, and the table
560
- of primes is only computed is ``maxprime`` is larger than the current
561
+ of primes is only computed if ``maxprime`` is larger than the current
561
562
bound.
562
563
563
564
Examples:
@@ -575,6 +576,11 @@ cdef class Pari(Pari_auto):
575
576
>>> pari.stacksize(), pari2.stacksize()
576
577
(10000000, 10000000)
577
578
579
+ >>> Pari().default("primelimit")
580
+ 500000
581
+ >>> Pari(maxprime=20000).default("primelimit")
582
+ 20000
583
+
578
584
For more information about how precision works in the PARI
579
585
interface, see :mod:`cypari2.pari_instance`.
580
586
@@ -603,6 +609,7 @@ cdef class Pari(Pari_auto):
603
609
set_pari_stack_size(size, sizemax)
604
610
605
611
# Increase the table of primes if needed
612
+ GP_DATA.primelimit = maxprime
606
613
self .init_primes(maxprime)
607
614
608
615
# Initialize some constants
@@ -1042,15 +1049,15 @@ cdef class Pari(Pari_auto):
1042
1049
>>> pari = cypari2.Pari()
1043
1050
>>> pari.init_primes(200000)
1044
1051
1045
- We make sure that ticket :trac:`11741` has been fixed::
1052
+ We make sure that ticket :trac:`11741` has been fixed:
1046
1053
1047
- >>> pari.init_primes(2**30)
1048
- Traceback (most recent call last):
1049
- ...
1050
- ValueError: Cannot compute primes beyond 436273290
1054
+ >>> pari.init_primes(2**30)
1055
+ Traceback (most recent call last):
1056
+ ...
1057
+ ValueError: Cannot compute primes beyond 436273290
1051
1058
"""
1052
- # Hardcoded bound in PARI sources
1053
- if M > 436273290 :
1059
+ # Hardcoded bound in PARI sources (language/forprime.c)
1060
+ if M > 436273289 :
1054
1061
raise ValueError (" Cannot compute primes beyond 436273290" )
1055
1062
1056
1063
if M <= maxprime():
0 commit comments