def float16(val):
    """Convert a 16-bit floating point value to a standard Python float."""
    frac = val & 1023
    exp = val >> 10 & 31
    sign = val >> 15
    if exp:
        value = 2 ** (exp - 16) * (1 + float(frac) / 2 ** 10)
    else:
        value = float(frac) / 2 ** 9
    if sign:
        value *= -1
    return value
