#NEWLINE# def mpf_besseljn( n , x , prec , rounding = round_fast ) : #NEWLINE# #INDENT# prec += 50 #NEWLINE# negate = ( ( n < 0 ) and ( n & 1 ) ) #NEWLINE# mag = ( x [ 2 ] + x [ 3 ] ) #NEWLINE# n = abs ( n ) #NEWLINE# wp = ( ( prec + 20 ) + ( n * bitcount ( n ) ) ) #NEWLINE# if ( mag < 0 ) : #NEWLINE# #INDENT# wp -= ( n * mag ) #NEWLINE# #UNINDENT# x = to_fixed ( x , wp ) #NEWLINE# x2 = ( ( x ** 2 ) >> wp ) #NEWLINE# if ( not n ) : #NEWLINE# #INDENT# s = t = ( MPZ_ONE << wp ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# s = t = ( ( ( x ** n ) // ifac ( n ) ) >> ( ( ( n - 1 ) * wp ) + n ) ) #NEWLINE# #UNINDENT# k = 1 #NEWLINE# while t : #NEWLINE# #INDENT# t = ( ( ( t * x2 ) // ( ( ( - 4 ) * k ) * ( k + n ) ) ) >> wp ) #NEWLINE# s += x2 #NEWLINE# k += 1 #NEWLINE# #UNINDENT# if negate : #NEWLINE# #INDENT# s = ( - s ) #NEWLINE# #UNINDENT# return from_man_exp ( s , ( - wp ) , prec , rounding )