def parse_ieee_extended(bitstream):
    """returns a parsed 80-bit IEEE extended value from BitstreamReader
    this is used to handle AIFF's sample rate field"""
    signed, exponent, mantissa = bitstream.parse('1u 15u 64U')
    if exponent == 0 and mantissa == 0:
        return 0
    elif exponent == 32767:
        return 1.79769313486231e+308
    else:
        f = mantissa * 2.0 ** (exponent - 16383 - 63)
        return f if not signed else -f
