Ticket #10635: trac_10635-fix_doctest_error_due_to_noise.reviewer.patch

File trac_10635-fix_doctest_error_due_to_noise.reviewer.patch, 1.4 KB (added by leif, 10 years ago)

Reviewer patch to fix doctest error on some systems (e.g. x86). Apply on top of other patch.

  • sage/rings/polynomial/polynomial_element.pyx

    # HG changeset patch
    # User Leif Leonhardy <not.really@online.de>
    # Date 1316984346 -7200
    # Node ID f85380402e48d283407e0bc9d679c554f18bd67c
    # Parent  c435bc27697472cfc3b52588ea806dc44cd34514
    #10635 Reviewer patch: Fix doctest error caused by varying order of factors due to noisy zero term.
    
    diff --git a/sage/rings/polynomial/polynomial_element.pyx b/sage/rings/polynomial/polynomial_element.pyx
    a b  
    24912491             sage: (x^2 + 1).factor()
    24922492             x^2 + 1
    24932493             sage: QQ._factor_univariate_polynomial = lambda f: f.change_ring(CDF).factor()
    2494              sage: (x^2 + 1).factor()
     2494             sage: fz = (x^2 + 1).factor(); fz # random order of factors, with noise
    24952495             (x - ... + I) * (x - I)
     2496             sage: # Change noisy zero term which affects the order of factors:
     2497             sage: Factorization(
     2498             ...       [ ( parent(f)(
     2499             ...               [ (0.0,im) if abs(re)<=1e-16 else (re,im)
     2500             ...                 for re,im in f
     2501             ...               ]),
     2502             ...           e )
     2503             ...         for f,e in fz
     2504             ...       ])
     2505             (x - I) * (x + I)
     2506             sage: # Clean up:
    24962507             sage: del QQ._factor_univariate_polynomial
    24972508       
    24982509        Arbitrary precision real and complex factorization::