# 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
|
|
| 446 | 446 | 18 |
| 447 | 447 | sage: Integer('012') |
| 448 | 448 | 10 |
| | 449 | |
| | 450 | Conversion from PARI:: |
| | 451 | |
| | 452 | sage: Integer(pari('-10380104371593008048799446356441519384')) |
| | 453 | -10380104371593008048799446356441519384 |
| | 454 | sage: Integer(pari('Pol([-3])')) |
| | 455 | -3 |
| 449 | 456 | """ |
| 450 | 457 | |
| 451 | 458 | def __cinit__(self): |
diff -r af5f40a73eda -r aa1613b4cd2b sage/rings/rational.pyx
|
a
|
b
|
|
| 328 | 328 | |
| 329 | 329 | sage: Rational(pari('-939082/3992923')) |
| 330 | 330 | -939082/3992923 |
| | 331 | sage: Rational(pari('Pol([-1/2])')) #9595 |
| | 332 | -1/2 |
| 331 | 333 | """ |
| 332 | 334 | def __cinit__(self): |
| 333 | 335 | global the_rational_ring |
| … |
… |
|
| 496 | 498 | mpq_canonicalize(self.value) |
| 497 | 499 | |
| 498 | 500 | elif isinstance(x, sage.libs.pari.all.pari_gen): |
| | 501 | x = x.simplify() |
| 499 | 502 | if typ((<pari_gen>x).g) == t_FRAC: |
| 500 | 503 | t_FRAC_to_QQ(self.value, (<pari_gen>x).g) |
| 501 | 504 | elif typ((<pari_gen>x).g) == t_INT: |