code: def from_str(x, prec, rnd=round_fast):
      """Create a raw mpf from a decimal literal, rounding in the
      specified direction if the input number cannot be represented
      exactly as a binary floating-point number with the given number of
      bits. The literal syntax accepted is the same as for Python
      floats.
  
      TODO: the rounding does not work properly for large exponents.
      """
      x = x.lower().strip()
      if x in special_str:
          return special_str[x]
  
      if "/" in x:
          p, q = x.split("/")
          p, q = p.rstrip("l"), q.rstrip("l")
          return from_rational(int(p), int(q), prec, rnd)
  
      man, exp = str_to_man_exp(x, base=10)
  
      # XXX: appropriate cutoffs & track direction
      # note no factors of 5
      if abs(exp) > 400:
          s = from_int(man, prec + 10)
          s = mpf_mul(s, mpf_pow_int(ften, exp, prec + 10), prec, rnd)
      else:
          if exp >= 0:
              s = from_int(man * 10**exp, prec, rnd)
          else:
              s = from_rational(man, 10**-exp, prec, rnd)
      return s
  
imports: import math
  from bisect import bisect
  import sys
  from .backend import MPZ, MPZ_TYPE, MPZ_ZERO, MPZ_ONE, MPZ_TWO, MPZ_FIVE, BACKEND, STRICT, HASH_MODULUS, HASH_BITS, gmpy, sage, sage_utils
  from .libintmath import giant_steps, trailtable, bctable, lshift, rshift, bitcount, trailing, sqrt_fixed, numeral, isqrt, isqrt_fast, sqrtrem, bin_to_radix
label_desc: Use image node_id 56 for calling a global function with example usage: from_str(x, prec, rnd) and returns: s, special_str, from_rational