code: def mpf_fibonacci(x, prec, rnd=round_fast):
      sign, man, exp, bc = x
      if not man:
          if x == fninf:
              return fnan
          return x
      # F(2^n) ~= 2^(2^n)
      size = abs(exp + bc)
      if exp >= 0:
          # Exact
          if size < 10 or size <= bitcount(prec):
              return from_int(ifib(to_int(x)), prec, rnd)
      # Use the modified Binet formula
      wp = prec + size + 20
      a = mpf_phi(wp)
      b = mpf_add(mpf_shift(a, 1), fnone, wp)
      u = mpf_pow(a, x, wp)
      v = mpf_cos_pi(x, wp)
      v = mpf_div(v, u, wp)
      u = mpf_sub(u, v, wp)
      u = mpf_div(u, b, prec, rnd)
      return u
  
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 39 for calling a global function with example usage: mpf_fibonacci(x, prec, rnd) and returns: u, x, fnan, from_int