#4670: prime_pi for input ~ 10^10 causes PariError
---------------------------+------------------------------------------------
Reporter: roed | Owner: was
Type: defect | Status: new
Priority: minor | Milestone: sage-3.2.2
Component: number theory | Resolution:
Keywords: |
---------------------------+------------------------------------------------
Changes (by mabshoff):
* milestone: => sage-3.2.2
Old description:
> Calling the primepi function on a large pari integer (10^10) causes an
> error. The issue is that in sage/libs/pari/gen.pyx the function
> init_primes casts the input to an unsigned long. If we don't want to
> allow initialization with input bigger than this, we should give a better
> error.
>
> sage: prime_pi(10^10)
> ---------------------------------------------------------------------------
> PariError Traceback (most recent call
> last)
>
> /Users/Roed/Math/sage-3.2/<ipython console> in <module>()
>
> /Users/Roed/Math/sage-3.2/local/lib/python2.5/site-
> packages/sage/functions/transcendental.pyc in __call__(self, x)
> 363 from sage.rings.integer import Integer
> 364 pari.init_primes(pari(x)+Integer(1))
> --> 365 return ZZ(pari(x).primepi())
> 366
> 367 def plot(self, xmin=0, xmax=100, *args, **kwds):
>
> /Users/Roed/Math/sage-3.2/local/lib/python2.5/site-
> packages/sage/libs/pari/gen.so in sage.libs.pari.gen._pari_trap
> (sage/libs/pari/gen.c:37972)()
>
> PariError: impossible assignment I-->S (23)
New description:
Calling the primepi function on a large pari integer ({{{10^10)}}} causes
an error. The issue is that in sage/libs/pari/gen.pyx the function
init_primes casts the input to an unsigned long. If we don't want to
allow initialization with input bigger than this, we should give a better
error.
{{{
sage: prime_pi(10^10)
---------------------------------------------------------------------------
PariError Traceback (most recent call
last)
/Users/Roed/Math/sage-3.2/<ipython console> in <module>()
/Users/Roed/Math/sage-3.2/local/lib/python2.5/site-
packages/sage/functions/transcendental.pyc in __call__(self, x)
363 from sage.rings.integer import Integer
364 pari.init_primes(pari(x)+Integer(1))
--> 365 return ZZ(pari(x).primepi())
366
367 def plot(self, xmin=0, xmax=100, *args, **kwds):
/Users/Roed/Math/sage-3.2/local/lib/python2.5/site-
packages/sage/libs/pari/gen.so in sage.libs.pari.gen._pari_trap
(sage/libs/pari/gen.c:37972)()
PariError: impossible assignment I-->S (23)
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4670#comment:1>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---