(text)
Parse a floating point number.

  Args:
    text: Text to parse.

  Returns:
    The number parsed.

  Raises:
    ValueError: If a floating point number couldn't be parsed.
Parse a floating point number.
Parse a floating point number .
def ParseFloat(text):
  """Parse a floating point number.

  Args:
    text: Text to parse.

  Returns:
    The number parsed.

  Raises:
    ValueError: If a floating point number couldn't be parsed.
  """
  try:
    # Assume Python compatible syntax.
    return float(text)
  except ValueError:
    # Check alternative spellings.
    if _FLOAT_INFINITY.match(text):
      if text[0] == '-':
        return float('-inf')
      else:
        return float('inf')
    elif _FLOAT_NAN.match(text):
      return float('nan')
    else:
      # assume '1.0f' format
      try:
        return float(text.rstrip('f'))
      except ValueError:
        raise ValueError('Couldn\'t parse float: %s' % text)
def ParseFloat ( text ) : try : # Assume Python compatible syntax. return float ( text ) except ValueError : # Check alternative spellings. if _FLOAT_INFINITY . match ( text ) : if text [ 0 ] == '-' : return float ( '-inf' ) else : return float ( 'inf' ) elif _FLOAT_NAN . match ( text ) : return float ( 'nan' ) else : # assume '1.0f' format try : return float ( text . rstrip ( 'f' ) ) except ValueError : raise ValueError ( 'Couldn\'t parse float: %s' % text )