Ticket #9595: 9595.patch

File 9595.patch, 1.4 KB (added by jdemeyer, 3 years ago)
  • sage/rings/integer.pyx

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1280061267 -7200
    # Node ID aa1613b4cd2bdee2bc451679b9e491d0745c3fed
    # Parent  af5f40a73eda5a6a0a811ef973ce57180b48953e
    #9595: simplify() before converting PARI gen to QQ.
    
    diff -r af5f40a73eda -r aa1613b4cd2b sage/rings/integer.pyx
    a b  
    446446        18 
    447447        sage: Integer('012') 
    448448        10 
     449     
     450    Conversion from PARI:: 
     451     
     452        sage: Integer(pari('-10380104371593008048799446356441519384')) 
     453        -10380104371593008048799446356441519384 
     454        sage: Integer(pari('Pol([-3])')) 
     455        -3 
    449456    """ 
    450457 
    451458    def __cinit__(self): 
  • sage/rings/rational.pyx

    diff -r af5f40a73eda -r aa1613b4cd2b sage/rings/rational.pyx
    a b  
    328328     
    329329        sage: Rational(pari('-939082/3992923')) 
    330330        -939082/3992923 
     331        sage: Rational(pari('Pol([-1/2])'))  #9595 
     332        -1/2 
    331333    """ 
    332334    def __cinit__(self): 
    333335        global the_rational_ring 
     
    496498            mpq_canonicalize(self.value) 
    497499 
    498500        elif isinstance(x, sage.libs.pari.all.pari_gen): 
     501            x = x.simplify() 
    499502            if typ((<pari_gen>x).g) == t_FRAC: 
    500503                t_FRAC_to_QQ(self.value, (<pari_gen>x).g) 
    501504            elif typ((<pari_gen>x).g) == t_INT: