#NEWLINE# def str_to_man_exp( x , base = 10 ) : #NEWLINE# #INDENT# 'Helper function for from_str.' #NEWLINE# float ( x ) #NEWLINE# x = x . lower ( ) #NEWLINE# parts = x . split ( 'e' ) #NEWLINE# if ( len ( parts ) == 1 ) : #NEWLINE# #INDENT# exp = 0 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# x = parts [ 0 ] #NEWLINE# exp = int ( parts [ 1 ] ) #NEWLINE# #UNINDENT# parts = x . split ( '.' ) #NEWLINE# if ( len ( parts ) == 2 ) : #NEWLINE# #INDENT# ( a , b ) = ( parts [ 0 ] , parts [ 1 ] . rstrip ( '0' ) ) #NEWLINE# exp -= len ( b ) #NEWLINE# x = ( a + b ) #NEWLINE# #UNINDENT# x = MPZ ( int ( x , base ) ) #NEWLINE# return ( x , exp )