# 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/sage/rings/real_mpfr.pyx
+++ b/sage/rings/real_mpfr.pyx
@@ -4689,6 +4689,11 @@
             [1.0621, 1.0621, 1.0622, 1.0621]
             sage: check(RealField(200)(e), 4)
             [1.2840254166877414840734205680624364583362808652814630892175, 1.2840254166877414840734205680624364583362808652814630892175, 1.2840254166877414840734205680624364583362808652814630892176, 1.2840254166877414840734205680624364583362808652814630892175]
+        
+        Check that #12105 is fixed::
+        
+            sage: RealField(53)(0.05).nth_root(7 * 10^8)
+            0.999999995720382
         """
         if n <= 0:
             raise ValueError, "n must be positive"
@@ -4705,7 +4710,7 @@
 
         cdef RealField_class fld = <RealField_class>self._parent
 
-        if algorithm == 0 and fld.__prec * n < 10000:
+        if algorithm == 0 and n <= 10000 / fld.__prec:
             # This is a rough estimate for when it is probably
             # faster to call mpfr directly.  (This is a pretty
             # good estimate on one particular machine, a
