#NEWLINE# def mpc_ellipk( z , prec , rnd = round_fast ) : #NEWLINE# #INDENT# ( re , im ) = z #NEWLINE# if ( im == fzero ) : #NEWLINE# #INDENT# if ( re == finf ) : #NEWLINE# #INDENT# return mpc_zero #NEWLINE# #UNINDENT# if mpf_le ( re , fone ) : #NEWLINE# #INDENT# return ( mpf_ellipk ( re , prec , r ) , fzero ) #NEWLINE# #UNINDENT# #UNINDENT# wp = ( prec + 15 ) #NEWLINE# a = mpc_sqrt ( mpc_sub ( mpc_one , z , wp ) , wp ) #NEWLINE# v = mpc_agm1 ( a , wp ) #NEWLINE# r = mpc_mpf_div ( mpf_pi ( wp ) , v , prec , rnd ) #NEWLINE# return mpc_shift ( r , ( - 1 ) )