def readFLOAT16(self):
        """ Read a 2 byte float """
        self.reset_bits_pending()
        word = self.readUI16()
        sign = -1 if ((word & 0x8000) != 0) else 1
        exponent = (word >> 10) & 0x1f
        significand = word & 0x3ff
        if exponent == 0:
            if significand == 0:
                return 0.0
            else:
                return sign * math.pow(2, 1 - SWFStream.FLOAT16_EXPONENT_BASE) * (significand / 1024.0)
        if exponent == 31:
            if significand == 0:
                return float('-inf') if sign < 0 else float('inf')
            else:
                return float('nan')
        # normal number
        return sign * math.pow(2, exponent - SWFStream.FLOAT16_EXPONENT_BASE) * (1 + significand / 1024.0)
def readFLOAT16 ( self ) : self . reset_bits_pending ( ) word = self . readUI16 ( ) sign = - 1 if ( ( word & 0x8000 ) != 0 ) else 1 exponent = ( word >> 10 ) & 0x1f significand = word & 0x3ff if exponent == 0 : if significand == 0 : return 0.0 else : return sign * math . pow ( 2 , 1 - SWFStream . FLOAT16_EXPONENT_BASE ) * ( significand / 1024.0 ) if exponent == 31 : if significand == 0 : return float ( '-inf' ) if sign < 0 else float ( 'inf' ) else : return float ( 'nan' ) return sign * math . pow ( 2 , exponent - SWFStream . FLOAT16_EXPONENT_BASE ) * ( 1 + significand / 1024.0 )
Read a 2 byte float