#NEWLINE# def i2d( x ) : #NEWLINE# #INDENT# if ( x == 0 ) : #NEWLINE# #INDENT# return 0 #NEWLINE# #UNINDENT# if ( x < 0 ) : #NEWLINE# #INDENT# return ( i2d ( ( - x ) ) ^ DOUBLE_SIGN ) #NEWLINE# #UNINDENT# shift = ( 53 - x . bit_length ( ) ) #NEWLINE# assert ( shift >= 0 ) #NEWLINE# mantissa = ( x << shift ) #NEWLINE# exponent = ( shift + 1023 ) #NEWLINE# return ( ( exponent << 52 ) | mantissa )