def bin_to_float(string: str):
    """Convert a string in binary to a float, if it possible."""

    if string.startswith('0b'):
        string = string[2:]

    integer, fractional = string.split('.')

    integer = int(integer, 2) if integer else 0

    if fractional:
        fractional = sum(int(bit) * 2 ** (-i) for i, bit in enumerate(fractional))
    else:
        fractional = 0

    return integer + fractional