On 11/1/07, Robert Bradshaw <[EMAIL PROTECTED]> wrote:
> > Maybe doesn't need a trac ticket?
> >
> > Nick
> >
> > Observe the mistaken comma:
> >
> > sage: factor(next_prime(ZZ(2)**45), next_prime(ZZ(3)**30))
> > ----------------------------------------------------------------------
> > --
> > ---
> > <type 'exceptions.OverflowError'>         Traceback (most recent call
> > last)
> >
> > /Users/ncalexan/Documents/School/MATH235/groebner/<ipython console>
> > in <module>()
> >
> > /Users/ncalexan/sage/local/lib/python2.5/site-packages/sage/rings/
> > arith.py in factor(n, proof, int_, algorithm, verbose, **kwds)
> >     1586     if algorithm == 'pari':
> >     1587         return factorization.Factorization
> > (__factor_using_pari(n,
> > -> 1588                                    int_=int_,
> > debug_level=verbose, proof=proof), unit)
> >     1589     elif algorithm == 'kash':
> >     1590         from sage.interfaces.all import kash
> >
> > /Users/ncalexan/sage/local/lib/python2.5/site-packages/sage/rings/
> > arith.py in __factor_using_pari(n, int_, debug_level, proof)
> >     1488     prev = pari.get_debug_level()
> >     1489     pari.set_debug_level(debug_level)
> > -> 1490     F = pari(n).factor(proof=proof)
> >     1491     B = F[0]
> >     1492     e = F[1]
> >
> > <type 'exceptions.OverflowError'>: long int too large to convert to
> > int
>
> I agree that it is a bad ticket, but what is this int_ parameter
> supposed to be? It is certainly a misleading error.

The problem has nothing to do with the int_ parameter.  The
problem is in the proof parameter.  The pari factor function that
gets called above has this signature:

def factor(gen self, limit=-1, bint proof=1):

The bint data type evidently gives that misleading error
message when the input overflows.    I think you wrote that
code (i.e., changing factor to use bint proof), so maybe
you'll have some insight into how you want to fix it.
Personally, I think I would just delete "bint" from the
declaration completely.  Then the

factor(next_prime(ZZ(2)**45), next_prime(ZZ(3)**30))

Would just output

next_prime(ZZ(2)**45)

since the second input  next_prime(ZZ(3)**30)
is nonzero, hence true, hence tells the factor command
to prove the result true :-).

William

 -- William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to