code: def log_taylor(x, prec, r=0):
      """
      Fixed-point calculation of log(x). It is assumed that x is close
      enough to 1 for the Taylor series to converge quickly. Convergence
      can be improved by specifying r > 0 to compute
      log(x^(1/2^r))*2^r, at the cost of performing r square roots.
  
      The caller must provide sufficient guard bits.
      """
      for i in xrange(r):
          x = isqrt_fast(x << prec)
      one = MPZ_ONE << prec
      v = ((x - one) << prec) // (x + one)
      sign = v < 0
      if sign:
          v = -v
      v2 = (v * v) >> prec
      v4 = (v2 * v2) >> prec
      s0 = v
      s1 = v // 3
      v = (v * v4) >> prec
      k = 5
      while v:
          s0 += v // k
          k += 2
          s1 += v // k
          v = (v * v4) >> prec
          k += 2
      s1 = (s1 * v2) >> prec
      s = (s0 + s1) << (1 + r)
      if sign:
          return -s
      return s
  
imports: import math
  from bisect import bisect
  from .backend import xrange
  from .backend import MPZ, MPZ_ZERO, MPZ_ONE, MPZ_TWO, MPZ_FIVE, BACKEND
  from .libmpf import round_floor, round_ceiling, round_down, round_up, round_nearest, round_fast, ComplexResult, bitcount, bctable, lshift, rshift, giant_steps, sqrt_fixed, from_int, to_int, from_man_exp, to_fixed, to_float, from_float, from_rational, normalize, fzero, fone, fnone, fhalf, finf, fninf, fnan, mpf_cmp, mpf_sign, mpf_abs, mpf_pos, mpf_neg, mpf_add, mpf_sub, mpf_mul, mpf_div, mpf_shift, mpf_rdiv_int, mpf_pow_int, mpf_sqrt, reciprocal_rnd, negative_rnd, mpf_perturb, isqrt_fast
  from .libintmath import ifib
label_desc: Use image node_id 24 for calling a global function with example usage: log_taylor(x, prec, r) and returns: s, unknown