#NEWLINE# def _calcFloat( x ) : #NEWLINE# #INDENT# assert ( x == normalizeFloat ( x ) ) #NEWLINE# if ( x in lookup . FLOATS ) : #NEWLINE# #INDENT# return lookup . FLOATS [ x ] #NEWLINE# #UNINDENT# exponent = ( ( ( x >> 23 ) & 255 ) - 127 ) #NEWLINE# mantissa = ( x % ( 1 << 23 ) ) #NEWLINE# if ( exponent == ( - 127 ) ) : #NEWLINE# #INDENT# exponent += 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# mantissa += ( 1 << 23 ) #NEWLINE# #UNINDENT# exponent -= 23 #NEWLINE# if ( x & FLOAT_SIGN ) : #NEWLINE# #INDENT# mantissa = ( - mantissa ) #NEWLINE# #UNINDENT# ex_combine_op = ( FDIV if ( exponent < 0 ) else FMUL ) #NEWLINE# exponent = abs ( exponent ) #NEWLINE# exponent_parts = bytearray ( ) #NEWLINE# while ( exponent >= 63 ) : #NEWLINE# #INDENT# exponent_parts . extend ( [ LCONST_1 , ICONST_M1 , LSHL , L2F , ex_combine_op ] ) #NEWLINE# mantissa = ( - mantissa ) #NEWLINE# exponent -= 63 #NEWLINE# #UNINDENT# if ( exponent > 0 ) : #NEWLINE# #INDENT# exponent_parts . append ( LCONST_1 ) #NEWLINE# exponent_parts . extend ( _calcInt ( exponent ) ) #NEWLINE# exponent_parts . extend ( [ LSHL , L2F , ex_combine_op ] ) #NEWLINE# #UNINDENT# return ( ( _calcInt ( mantissa ) + bytes ( [ I2F ] ) ) + exponent_parts )