#NEWLINE# def mpc_ellipe( z , prec , rnd = round_fast ) : #NEWLINE# #INDENT# ( re , im ) = z #NEWLINE# if ( im == fzero ) : #NEWLINE# #INDENT# if ( re == finf ) : #NEWLINE# #INDENT# return ( fzero , finf ) #NEWLINE# #UNINDENT# if mpf_le ( re , fone ) : #NEWLINE# #INDENT# return ( mpf_ellipe ( re , prec , rnd ) , fzero ) #NEWLINE# #UNINDENT# #UNINDENT# wp = ( prec + 15 ) #NEWLINE# mag = mpc_abs ( z , 1 ) #NEWLINE# p = ( max ( ( rnd [ 2 ] + mag [ 3 ] ) , 0 ) - wp ) #NEWLINE# h = mpf_shift ( fone , p ) #NEWLINE# K = mpc_ellipk ( z , ( 2 * wp ) ) #NEWLINE# Kh = mpc_ellipk ( mpc_add_mpf ( z , h , ( 2 * wp ) ) , ( 2 * wp ) ) #NEWLINE# Kdiff = mpc_shift ( mpc_sub ( Kh , K , wp ) , ( - p ) ) #NEWLINE# t = mpc_sub ( mpc_one , z , wp ) #NEWLINE# b = mpc_mul ( Kdiff , mpc_shift ( z , 1 ) , wp ) #NEWLINE# return mpc_mul ( t , mpc_add ( K , b , wp ) , prec , rnd )