From 7423e611f5bfbcb4235c262ecf4340226bb80b35 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 13 Jun 2024 16:46:50 +0100 Subject: [PATCH] fix: make roots doctests compatible with latest Flint --- src/flint/types/acb_poly.pyx | 12 ++++++------ src/flint/types/fmpz_poly.pyx | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/flint/types/acb_poly.pyx b/src/flint/types/acb_poly.pyx index 7deca804..13508899 100644 --- a/src/flint/types/acb_poly.pyx +++ b/src/flint/types/acb_poly.pyx @@ -349,13 +349,13 @@ cdef class acb_poly(flint_poly): The input polynomial must be squarefree and sufficiently accurate. Raises an exception if unsuccessful. - >>> for c in acb_poly.from_roots([1,2,3,4,5]).roots(1e-10): print(c) + >>> for c in acb_poly.from_roots([1,2,3,4,5]).roots(1e-10): print(float(c.real)) ... - [1.00000000000000 +/- 7.71e-18] + [+/- 7.59e-18]j - [2.00000000000000 +/- 1.18e-16] + [+/- 1.16e-16]j - [3.00000000000000 +/- 4.24e-16] + [+/- 4.22e-16]j - [4.00000000000000 +/- 7.21e-16] + [+/- 7.00e-16]j - [5.00000000000000 +/- 2.41e-16] + [+/- 2.24e-16]j + 1.0 + 2.0 + 3.0 + 4.0 + 5.0 >>> for c in acb_poly.from_roots([1,2,2,4,5]).roots(1e-10): print(c) ... Traceback (most recent call last): diff --git a/src/flint/types/fmpz_poly.pyx b/src/flint/types/fmpz_poly.pyx index 4630e420..52314404 100644 --- a/src/flint/types/fmpz_poly.pyx +++ b/src/flint/types/fmpz_poly.pyx @@ -391,13 +391,13 @@ cdef class fmpz_poly(flint_poly): >>> fmpz_poly([2,0,1]).complex_roots() [([1.41421356237310 +/- 4.96e-15]j, 1), ([-1.41421356237310 +/- 4.96e-15]j, 1)] >>> for c, m in (fmpz_poly([2,3,4]) * fmpz_poly([5,6,7,11])**3).complex_roots(): - ... print((c,m)) + ... print(f'{float(c.real)} + {float(c.imag)}*j : {m}') ... - ([-0.375000000000000 +/- 1.0e-19] + [0.599478940414090 +/- 5.75e-17]j, 1) - ([-0.375000000000000 +/- 1.0e-19] + [-0.599478940414090 +/- 5.75e-17]j, 1) - ([-0.735284727404843 +/- 4.11e-16], 3) - ([0.0494605455206031 +/- 1.33e-17] + [0.784693167647185 +/- 2.85e-16]j, 3) - ([0.0494605455206031 +/- 1.33e-17] + [-0.784693167647185 +/- 2.85e-16]j, 3) + -0.375 + 0.5994789404140899*j : 1 + -0.375 + -0.5994789404140899*j : 1 + -0.7352847274048426 + 0.0*j : 3 + 0.04946054552060311 + 0.7846931676471847*j : 3 + 0.04946054552060311 + -0.7846931676471847*j : 3 """ cdef fmpz_poly_factor_t fac