from typing import Tuple
from typing import Optional


def _match_float(text: str) -> Tuple[str, Optional[float]]:
    """Tries to match a floating point (real) value.

    Args:
        text (str): The string containing the floating point value.

    Returns:
        Tuple[str, Optional[float]]: A tuple containing the remaining text and floating point value if the
                                     match was successful, the original text and None otherwise.

    """
    if len(text) == 0:
        return '', None

    # Match sign
    i = 1 if text[0] in '+-' else 0

    has_dot = False
    has_value = False

    for i in range(i, len(text)):
        if text[i] in '0123456789':
            has_value = True
        elif text[i] in '.':
            if has_dot:
                return text, None
            has_dot = True
        elif text[i] in '() \t\v\f\r\n':
            return (text[i:], float(text[:i])) if has_dot and has_value else (text, None)
        elif text[i] in 'eE' and has_value and i != len(text) - 1:
            break  # Continue by matching exponent
        else:
            return text, None
    else:
        return (text[i+1:], float(text[:i+1])) if has_dot and has_value else (text, None)

    # Match 'e|E', match sign
    i += 2 if text[i+1] in '+-' else 1

    has_value = False

    for i in range(i, len(text)):
        if text[i] in '0123456789':
            has_value = True
        elif text[i] in '() \t\v\f\r\n':
            return (text[i:], float(text[:i])) if has_value else (text, None)
        else:
            return text, None

    return (text[i+1:], float(text[:i+1])) if has_value else (text, None)