@@ -462,7 +462,7 @@ def _tento(n):
462462 return (5 ** n ) << n
463463
464464
465- def _is_leq_than_pow10a_use_str (q , a ):
465+ def _is_less_than_pow10a_use_str (q , a ):
466466 """Try to efficiently check len(str(q)) <= a, or equivalently q < 10**a.
467467
468468 If it is not possible to efficiently compute len(str(q)),
@@ -476,14 +476,14 @@ def _is_leq_than_pow10a_use_str(q, a):
476476 # log2(q) >= a*log2(10) >= a*z > q.bit_length().
477477 # In particular, q > 2**q.bit_length(), which is impossible.
478478
479- # assert q < 10 ** context.prec
479+ # assert q < 10 ** a
480480 return True , None
481481 elif q .bit_length () >= 1 + a * _LOG_10_BASE_2_HI :
482482 # Claim: If z > log2(10) and q.bit_length() >= 1 + a*z, then q > 10**a.
483483 # Proof: Since q >= 2**(q.bit_length()-1), we have
484484 # q >= 2**(q.bit_length()-1) >= 2**(a*z) > 2**(a*log2(10)) = 10**a.
485485
486- # assert q > 10 ** context.prec
486+ # assert q > 10 ** a
487487 return False , None
488488 # Handles other cases due to floating point precision loss
489489 # when computing _LOG_10_BASE_2_LO and _LOG_10_BASE_2_HI.
@@ -492,7 +492,7 @@ def _is_leq_than_pow10a_use_str(q, a):
492492 return is_valid , str_q
493493
494494
495- def _is_leq_than_pow10a (q , a , * , exact = True , ulp_order = 20 ):
495+ def _is_less_than_pow10a (q , a , * , exact = True , ulp_order = 20 ):
496496 """Check that len(str(q)) <= a without computing str(q).
497497
498498 When *exact* is false, computing len(str(q)) is replaced by f(q):
@@ -505,7 +505,6 @@ def _is_leq_than_pow10a(q, a, *, exact=True, ulp_order=20):
505505 When *exact* is true, computing len(str(q)) requires one bigint
506506 exponentiation that only depends on q.
507507 """
508-
509508 if q < 10 :
510509 return a >= 1
511510
@@ -1441,7 +1440,7 @@ def _divide(self, other, context):
14411440 else :
14421441 op2 .int *= 10 ** (op2 .exp - op1 .exp )
14431442 q , r = divmod (op1 .int , op2 .int )
1444- is_valid , str_q = _is_leq_than_pow10a_use_str (q , context .prec )
1443+ is_valid , str_q = _is_less_than_pow10a_use_str (q , context .prec )
14451444 if is_valid :
14461445 if str_q is None :
14471446 str_q = str (q )
@@ -1602,7 +1601,7 @@ def remainder_near(self, other, context=None):
16021601 r -= op2 .int
16031602 q += 1
16041603
1605- if not _is_leq_than_pow10a (q , context .prec ):
1604+ if not _is_less_than_pow10a (q , context .prec ):
16061605 # assert q >= 10 ** context.prec
16071606 # assert len(str(q)) > context.prec
16081607 return context ._raise_error (DivisionImpossible )
0 commit comments