code: def erfinv(ctx, x):
      xre = ctx._re(x)
      if (xre != x) or (xre < -1) or (xre > 1):
          return ctx.bad_domain(
              "erfinv(x) is defined only for -1 <= x <= 1"
          )
      x = xre
      # if ctx.isnan(x): return x
      if not x:
          return x
      if x == 1:
          return ctx.inf
      if x == -1:
          return ctx.ninf
      if abs(x) < 0.9:
          a = 0.53728 * x**3 + 0.813198 * x
      else:
          # An asymptotic formula
          u = ctx.ln(2 / ctx.pi / (abs(x) - 1) ** 2)
          a = ctx.sign(x) * ctx.sqrt(u - ctx.ln(u)) / ctx.sqrt(2)
      ctx.prec += 10
      return ctx.findroot(lambda t: ctx.erf(t) - x, a)
  
imports: from .functions import defun, defun_wrapped
label_desc: Use image node_id 7 for calling a global function with example usage: erfinv(ctx, x) and returns: ctx, ctx, x, ctx, ctx