Ticket #12105: 12105.patch

File 12105.patch, 1.3 KB (added by johanbosman, 3 years ago)
  • sage/rings/real_mpfr.pyx

    # HG changeset patch
    # User Johan Bosman <johan.g.bosman@gmail.com>
    # Date 1322841644 -3600
    # Node ID d0ad1e2135446e96ac319ccbcc57c2770267506a
    # Parent  48f265a4198662ab60132f930b818b65a28089fa
    Trac 12105: fix buggy if-statement
    
    diff --git a/sage/rings/real_mpfr.pyx b/sage/rings/real_mpfr.pyx
    a b  
    46894689            [1.0621, 1.0621, 1.0622, 1.0621] 
    46904690            sage: check(RealField(200)(e), 4) 
    46914691            [1.2840254166877414840734205680624364583362808652814630892175, 1.2840254166877414840734205680624364583362808652814630892175, 1.2840254166877414840734205680624364583362808652814630892176, 1.2840254166877414840734205680624364583362808652814630892175] 
     4692         
     4693        Check that #12105 is fixed:: 
     4694         
     4695            sage: RealField(53)(0.05).nth_root(7 * 10^8) 
     4696            0.999999995720382 
    46924697        """ 
    46934698        if n <= 0: 
    46944699            raise ValueError, "n must be positive" 
     
    47054710 
    47064711        cdef RealField_class fld = <RealField_class>self._parent 
    47074712 
    4708         if algorithm == 0 and fld.__prec * n < 10000: 
     4713        if algorithm == 0 and n <= 10000 / fld.__prec: 
    47094714            # This is a rough estimate for when it is probably 
    47104715            # faster to call mpfr directly.  (This is a pretty 
    47114716            # good estimate on one particular machine, a