def string_to_general_float(s: str) -> float:
    """
    Convert a string to corresponding single or double precision scientific number.

    :param s: a string could be '0.1', '1e-5', '1.0D-5', or any other validated number
    :return: a float or raise an error

    .. doctest::

        >>> string_to_general_float('1.0D-5')
        1e-05
        >>> string_to_general_float('1Dx')
        Traceback (most recent call last):
            ...
        ValueError: The string '1Dx' does not corresponds to a double precision number!
        >>> string_to_general_float('.8d234')
        8e+233
        >>> string_to_general_float('0.1')
        0.1
    """
    if 'D' in s.upper():  # Possible double precision number
        try:
            return string_to_double_precision_float(s)
        except ValueError:
            raise ValueError(
                "The string '{0}' does not corresponds to a double precision number!".format(s))
    else:
        return float(s)
def string_to_general_float ( s : str ) -> float : if 'D' in s . upper ( ) : try : return string_to_double_precision_float ( s ) except ValueError : raise ValueError ( "The string '{0}' does not corresponds to a double precision number!" . format ( s ) ) else : return float ( s )
Convert a string to corresponding single or double precision scientific number.

    :param s: a string could be '0.1', '1e-5', '1.0D-5', or any other validated number
    :return: a float or raise an error

    .. doctest::

        >>> string_to_general_float('1.0D-5')
        1e-05
        >>> string_to_general_float('1Dx')
        Traceback (most recent call last):
            ...
        ValueError: The string '1Dx' does not corresponds to a double precision number!
        >>> string_to_general_float('.8d234')
        8e+233
        >>> string_to_general_float('0.1')
        0.1