403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.206
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/mpmath/libmp/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/mpmath/libmp/__pycache__/libelefun.cpython-310.pyc
o

�"`U��	@s�dZddlZddlmZddlmZddlmZmZmZmZm	Z	m
Z
ddlm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/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8ddl9m:Z:e
d	kr�d
Z;ndZ;dZ<e
d	kr�dZ=nd
Z=dZ>iZ?dZ@iZAdZBdZCiZDdZEdZFdZGiZHddgZIedeeB�d�D]ZJeIeKdeJeB�dgdeJd7ZIq�dd�ZLdd�ZMdd�ZNdd�ZOd�d d!�ZPeLd"d#��ZQeLd$d%��ZR	ed&�ZSed'�ZTed(�ZUed)�ZVd*d+�ZWeLd�d,d-��ZXd.d/�ZYd0d1�ZZeLd2d3��Z[eLd4d5��Z\eMe\�Z]eMeX�Z^eMe[�Z_eMeY�Z`eMeQ�ZaeMeR�ZbeLd6d7��ZceLd8d9��ZdeMed�ZeeMec�Zfefd:d;�Zgd<d=�Zhd>d?�Ziefd@dA�ZjefdBdC�Zkd�dDdE�ZldFdG�ZmdHdI�Znd�dJdK�ZodLdM�ZpefdNdO�ZqdPdQ�ZrdRdS�ZsdTdU�ZtdVdW�ZudXdY�ZvefdZd[�Zwefd\d]�Zxefd^d_�Zyefd`da�Zzefdbdc�Z{efddde�Z|efdfdg�Z}efdhdi�Z~d�djdk�Zdldm�Z�dndo�Z�dpdq�Z�efdrds�Z�edfdtdu�Z�dvdw�Z�eddfdxdy�Z�efdzd{�Z�efd|d}�Z�efd~d�Z�efd�d��Z�efd�d��Z�efd�d��Z�efd�d��Z�efd�d��Z�efd�d��Z�d�d�d��Z�d�d�d��Z�e
d�k�rtz*ddl�m�m�m�Z�e�j4Z4e�j�Z�e�jqZqe�j�Z�e�j�Z�e�jgZge�j�Z�e�j�Z�e�jlZlWdSe�e�f�yse�d��YdSwdS)�a(
This module implements computation of elementary transcendental
functions (powers, logarithms, trigonometric and hyperbolic
functions, inverse trigonometric and hyperbolic) for real
floating-point numbers.

For complex and interval implementations of the same functions,
see libmpc and libmpi.

�N)�bisect�)�xrange)�MPZ�MPZ_ZERO�MPZ_ONE�MPZ_TWO�MPZ_FIVE�BACKEND)-�round_floor�
round_ceiling�
round_down�round_up�
round_nearest�
round_fast�
ComplexResult�bitcount�bctable�lshift�rshift�giant_steps�
sqrt_fixed�from_int�to_int�from_man_exp�to_fixed�to_float�
from_float�
from_rational�	normalize�fzero�fone�fnone�fhalf�finf�fninf�fnan�mpf_cmp�mpf_sign�mpf_abs�mpf_pos�mpf_neg�mpf_add�mpf_sub�mpf_mul�mpf_div�	mpf_shift�mpf_rdiv_int�mpf_pow_int�mpf_sqrt�reciprocal_rnd�negative_rnd�mpf_perturb�
isqrt_fast)�ifib�python�Xi�i����i�i�	�	�i����cs,d�_d�_�fdd�}�j|_�j|_|S)z�
    Decorator for caching computed values of mathematical
    constants. This decorator should be applied to a
    function taking a single argument prec as input and
    returning a fixed-point value with the given precision.
    ���NcsR�j}||kr�j||?St|dd�}�|fi|���_|�_�j||?S)Ng�������?�
)�	memo_prec�memo_val�int)�prec�kwargsrD�newprec��f��8/usr/lib/python3/dist-packages/mpmath/libmp/libelefun.py�g^szconstant_memo.<locals>.g)rDrE�__name__�__doc__)rKrNrLrJrM�
constant_memoUsrQcstf�fdd�	}�j|_|S)z�
    Create a function that computes the mpf value for a mathematical
    constant, given a function that computes the fixed-point value.

    Assumptions: the constant is positive and has magnitude ~= 1;
    the fixed-point function rounds to floor.
    cs<|d}�|�}|ttfvr|d7}td||t|�||�S)Nr>rr)rrrr)rG�rnd�wp�v��fixedrLrMrKrs
zdef_mpf_constant.<locals>.f)rrP)rVrKrLrUrM�def_mpf_constantjsrWcCs�||dkr'td|d�}|s|d@rt||d|fSt||d|fS||d}t||||�\}}}t||||�\}	}
}|
|||	||
||fS)NrrA�)rr�bsp_acot)�q�a�b�
hyperbolic�a1�m�p1�q1�r1�p2�q2�r2rLrLrMrY{srYcCsBtd|t�|�d�}t|d||�\}}}|||>||S)z�
    Compute acot(a) or acoth(a) for an integer a with binary splitting; see
    http://numbers.computation.free.fr/Constants/Algorithms/splitting.html
    �ffffff�?r>r)rF�math�logrY)r[rGr]�N�prZ�rrLrLrM�
acot_fixed�srlFcCs>d}t}|D]\}}|t|�tt|�|||�7}q||?S)z�
    Evaluate a Machin-like formula, i.e., a linear combination of
    acot(n) or acoth(n) for specific integer values of n, using fixed-
    point arithmetic. The input should be a list [(c, n), ...], giving
    c*acot[h](n) + ...
    rC)rrrl)�coefsrGr]�	extraprec�sr[r\rLrLrM�machin�s
"rpcC�tgd�|d�S)zz
    Computes ln(2). This is done with a hyperbolic Machin-type formula,
    with binary splitting at high precision.
    ))��)���i�)r<i-"T�rp�rGrLrLrM�	ln2_fixed�srwcCrq)zN
    Computes ln(10). This is done with a hyperbolic Machin-type formula.
    ))�.�)�"�1)r>�TrurvrLrLrM�
ln10_fixed�sr}iqc�i�-~ i@�	�cCs�||dkr1td|dd|dd|d�}|dtdd}d||tt|}n:|r=|dkr=td	||�||d}t|||d|�\}}	}
t|||d|�\}}}
|	|}||}|
||
|}|||fS)
z�
    Computes the sum from a to b of the series in the Chudnovsky
    formula. Returns g, p, q where p/q is the sum as an exact
    fraction and g is a temporary value used to save work
    for recursive calls.
    r��rArX�rB�z  binary splitting)r�CHUD_C�CHUD_A�CHUD_B�print�
bs_chudnovsky)r[r\�level�verboserNrjrZ�mid�g1r`ra�g2rcrdrLrLrMr��s(
r�c	Csft|ddd�}|rtd|�td|d|�\}}}ttd|>�}|t||t|t}|S)z�
    Compute floor(pi * 2**prec) as a big integer.

    This is done using Chudnovsky's series (see comments in
    libelefun.py for details).
    g��v	O�
@gbi�],@rAzbinary splitting with N =r)rFr�r�r7r�r��CHUD_D)	rGr��verbose_baserirNrjrZ�sqrtCrTrLrLrM�pi_fixed�s	
r�cCst|�dS)N�)r�rvrLrLrM�degree_fixed�sr�cCsT||dkrtt|�fS||d}t||�\}}t||�\}}|||||fS)ze
    Sum series for exp(1)-1 between a, b, returning the result
    as an exact fraction (p, q).
    rrA)rr�bspe)r[r\r_r`rarcrdrLrLrMr��sr�cCs8td|t�|�d�}td|�\}}|||>|S)z�
    Computes exp(1). This is done using the ordinary Taylor series for
    exp, with binary splitting. For a description of the algorithm,
    see:

        http://numbers.computation.free.fr/Constants/
            Algorithms/splitting.html
    g�������?r>r)rFrgrhr�)rGrirjrZrLrLrM�e_fixed	sr�cCs(|d7}ttd|>�t|>}|d?S)z2
    Computes the golden ratio, (1+sqrt(5))/2
    rCrA�)r7r	r)rGr[rLrLrM�	phi_fixedsr�cCs&|d}tttt|�d�|�|d�S)NrCr)r�mpf_logr0�mpf_pi)rGrSrLrLrM�ln_sqrt2pi_fixed*sr�cCstt|�|�S�N)rr�rvrLrLrM�sqrtpi_fixed0�r�c
Cs�|\}}}}|\}}	}
}|r|
dkrtd��|
dkr't|d||	|
>||�S|
dkre|	dkrF|r@ttt||dt|�||�St|||�S|rXtt||dt|�|	||�Stt||d|�|	||�St||d|�}tt||�||�S)zV
    Compute s**t. Raises ComplexResult if s is negative and t is
    fractional.
    rz,negative number raised to a fractional powerrBrrC)	rr2r/r!r3r4r��mpf_expr.)
ro�trGrR�ssign�sman�sexp�sbc�tsign�tman�texp�tbc�crLrLrM�mpf_pow>s0����r�c
Cs|dkr
||dfSt|�}d}d|dt|�d}t\}}}}		|d@r\||}||}|	|d7}	|	tt||	?�}	|	|krQ||	|?}||	|7}|}	|d8}|s\	||fS||}||}||d}|tt||?�}||kr�|||?}|||7}|}|d}q#)z�n-th power of a fixed point number with precision prec

       Returns the power in the form man, exp,
       man * 2**exp ~= y**n
    rArr�r)rr!rrF)
�y�nrG�bc�exp�workprec�_�pm�pe�pbcrLrLrM�
int_pow_fixedZs<
��r�cCsd}zt||||�}tt|d|��}Wn"ty9t||�}t|�}td||�}t|||�}t|�}Ynwd}|}	|}
t|||�D]9}t	||d|
�\}}
t||d|
||
|	�}t
|d|||	�|}||dt
|||
�|}|}
qG|S)N�2g�?rrCrA)rrrF�
OverflowErrorrr1r�rrr�r)r�r�rG�exp1�start�y1rk�fn�extra�extra1�prevprjr�r�re�BrLrLrM�
nthroot_fixed�s*
�r�cCsl|\}}}}|rtd��|s2|tkrtS|tkr&|dkrtS|dkr$tStS|s*tS|dkr0tStSd}|dkrb|dkr>tS|dkrHt|||�S|dkrStt|||�St|}d}d}	||	7}|}|d	kr�|d
ksv|tdd|d
�kr�|d}
t	|�}t
d||
�}t|||
|�}
t|
d|
d|
d|
d||�}|r�tt|||	|�S|S|d|||}
|dkr�|
|
d7}
|
|
|}
||
}d}||}|dkr�d}|}|r�|||7}n|||8}t
||�}d}|||d|
||}d}|�r|dk�s	|dk�rd}n|dk�s|dk�rd}t||||
|�}t||||�}|�r4tt|||	|�S|S)zanth-root of a positive number

    Use the Newton method when faster, otherwise use x**(1/n)
    znth root of a negative numberrFrArrBTr�r>i N��g�����L<@gףp=
��?rCrX�ur��drK)rr&r r!r$r*r/r4rFrr1r�rrr�r)ror�rGrR�sign�manr�r��flag_inverse�
extra_inverse�prec2r��nthrk�shift�sign1�esr�r��	rnd_shiftrLrLrM�mpf_nthroot�s�("
�r�cCst|d||�S)zcubic root of a positive numberrX)r�)rorGrRrLrLrM�mpf_cbrt�r�r�c	Cs�|tvrt|\}}||kr|||?S|d}|tkr8|dur$t|�}t|�}|||>}t||�||}nttt|�|d�|�}|tkrN||ft|<|||?S)z`
    Fast computation of log(n), caching the value for small n,
    intended for zeta sums.
    rCNr�)	�
log_int_cache�LOG_TAYLOR_SHIFTrwr�log_taylor_cachedrr�r�MAX_LOG_INT_CACHE)	r�rG�ln2�value�vprecrSrk�xrTrLrLrM�
log_int_fixedsr�cCsHd}	||d?}|dkrt||�dkr|St||�}|}|d7}q)z^
    Fixed-point computation of agm(a,b), assuming
    a, b both close to unit magnitude.
    rrr�r<)�absr7)r[r\rG�i�anewrLrLrM�	agm_fixeds�r�cCs�|||?}|}}}|r |||?}|||?}||7}|s|t|>7}|||d?}|t||>�|?}|}}}|rR|||?}|||?}||7}|s@t|>|d>}|||?}t|||�}t|�|>|S)a*
    Fixed-point computation of -log(x) = log(1/x), suitable
    for large precision. It is required that 0 < x < 1. The
    algorithm used is the Sasaki-Kanada formula

        -log(x) = pi/agm(theta2(x)^2,theta3(x)^2). [1]

    For faster convergence in the theta functions, x should
    be chosen closer to 0.

    Guard bits must be added by the caller.

    HYPOTHESIS: if x = 2^(-n), n bits need to be added to
    account for the truncation to a fixed-point number,
    and this is the only significant cancellation error.

    The number of bits lost to roundoff is small and can be
    considered constant.

    [1] Richard P. Brent, "Fast Algorithms for High-Precision
        Computation of Elementary Functions (extended abstract)",
        http://wwwmaths.anu.edu.au/~brent/pd/RNC7-Brent.pdf

    rAr)rr7r�r�)r�rG�x2ror[r\r�rjrLrLrM�log_agm)s(��r�c
Cs�t|�D]}t||>�}qt|>}|||>||}|dk}|r$|}|||?}|||?}|}	|d}
|||?}d}|r\|	||7}	|d7}|
||7}
|||?}|d7}|s@|
||?}
|	|
d|>}|ro|S|S)a:
    Fixed-point calculation of log(x). It is assumed that x is close
    enough to 1 for the Taylor series to converge quickly. Convergence
    can be improved by specifying r > 0 to compute
    log(x^(1/2^r))*2^r, at the cost of performing r square roots.

    The caller must provide sufficient guard bits.
    rrXr�rAr)rr7r)
r�rGrkr��onerTr��v2�v4�s0�s1�krorLrLrM�
log_taylorXs2	�r�cCs&||t?}t|}||}||ftvrt||f\}}n||t>}t||d�}||ft||f<||L}||L}|||>|}||>t|>|}|||?}	|	|	|?}
|}|d}||
|?}d}
|r�|||
7}|
d7}
|||
7}||
|?}|
d7}
|sg||	|?}||d>}||S)zd
    Fixed-point computation of log(x), assuming x in (0.5, 2)
    and prec <= LOG_TAYLOR_PREC.
    r<rXr�rAr)r��cache_prec_steps�log_taylor_cacher�r)r�rGr��cached_prec�dprecr[�log_ar�rTr�r�r�r�r�rorLrLrMr�zs8�r�cCs�|\}}}}|s|tkrtS|tkrtS|tkrtS|r td��|d}|dkr8|s,tSt|t|�|||�S||}t|�}	|	dkr{d|	}
|
rQt|>|}n|t|d>}t	|�}||}
|
|krwt
|
||	|||d�}t||
||�S||
7}|	dkr�t	|	�|kr�t|t|�|||�S|tkr�t
t|||�|�}|r�||t|�7}n$|t}||}t||�}||7}tt||�|�}||t|�8}t||||�S)zj
    Compute the natural logarithm of the mpf value x. If x is negative,
    ComplexResult is raised.
    zlogarithm of a negative numberr>rr�i')r r%r$r&rrrwr�rrrr6�LOG_TAYLOR_PRECr�r�LOG_AGM_MAG_PREC_RATIOr0r�r)r�rGrRr�r�r�r�rS�mag�abs_magr�r�r��cancellationr�r_�optimal_magr�rLrLrMr��sP�


r�c
Cs|ds	||}}|ds;|ds'||krtkrtSt||fvr%tStS|tkr3tt|�||�S|tkr9tStSt||�}t||�}d}t||||�}t|td�}|d|d}	|tksh|	|dkryt||||t	|d|d��}t
t|||�d�S)z1
    Computes log(sqrt(a^2+b^2)) accurately.
    rr>rCrArXrB)r r%r&r$r�r)r.r,r"�minr0)
r[r\rGrR�a2�b2r��h2�	cancelled�
mag_cancelledrLrLrM�
mpf_log_hypot�s0
�

"r�c
Cs�|dkrt�t||d?�d�}nt�t|�d|�}d}tt|d�d|?�}d}t||�D]4}||7}|||>}t||�\}}||>|}|t|||�|>t|>|d|?}	||	}|}q2t|||�S)N�d�5g@Cg@r�rA)rg�atanrFrr�
cos_sin_fixedrr)
r�rGrkr��extra_prS�cos�sin�tanr[rLrLrM�atan_newtons*r�cCspdt|d�>d}||}||ftvrt||f\}}n||t>}t||�}||ft||f<||?||?fS)Nrr>)r�atan_taylor_cache�ATAN_TAYLOR_SHIFTr�)r�rGr�r�r[�atan_arLrLrM�atan_taylor_get_cached"s
rc
Cs�||t?}t||�\}}||}||>|d|?|||?t|>}}|d|?}|||?}	|d}
||	|?}d}|r]|||7}|d7}|
||7}
||	|?}|d7}|sA|
||?}
||
}||S)NrArXr�)r�rr)
r�rGr�r[rr�r�rTr�r�r�r�rorLrLrM�atan_taylor1s&,�rcCs,|s
tt||�d�Sttt|t|�d��S)NrB)r0r�r+r5)r�rGrRrLrLrM�atan_infEsrcCs|\}}}}|s$|tkrtS|tkrtd||�S|tkr"td||�StS||}||dkr4t|||�S||dkrDt|d|||�S|dt|�}|dkrYtd||�}d}	nd}	t||�}
|re|
}
|t	krot
|
|�}nt|
|�}|	r�t|�d?d|}|r�|}t
||||�S)Nrrr>�rATF)r r$rr%r&r6r�r1r�ATAN_TAYLOR_PRECrr�r�r)r�rGrRr�r�r�r�r�rS�
reciprocalr�r[rLrLrM�mpf_atanJs6

rc
Cs>|\}}}}|\}}	}
}|	sK|tkr#|tkr#t|�dkrtSt||�S|ttfvrI|ttfvr1tS|tkr=tt||�d�Sttt|t|�d��StS|rZtt	t|�||t|��S|s|tkrbtS|tkrhtS|tkrqt||�S|tkrwtStt||�d�St
t|||d�|d�}|r�tt|d�|||�St
|||�S)NrrBr�)r r&r(r�r$r%r0r+r5�	mpf_atan2rr/r,r*)
r�r�rGrR�xsign�xman�xexp�xbc�ysign�yman�yexp�ybc�tquorLrLrMrms<

rcCsv|\}}}}||dkr|ttfvrtd��|d}t||�}ttttt||�|�|�}	t||	|�}
tt	|
||�d�S)Nrz%asin(x) is real only for -1 <= x <= 1�r)
r!r"rr.r,r3r-r/r0r�r�rGrRr�r�r�r�rSr[r\r�rLrLrM�mpf_asin�s
rcCs�|\}}}}||dkr|ttfvrtd��|tkrt||�S|d}t||�}ttt||�|�}	t|	tt||�|�}
t	t
|
||�d�S)Nrz%acos(x) is real only for -1 <= x <= 1rr)r!r"rr�r.r3r-r/r,r0rrrLrLrM�mpf_acos�s

rc
Cs�|d}|\}}}}||}|dkr%||kr t|d|||�S||7}ttt||�t|�|�}	tt|�|	|�}	|rEtt|	|t|��St|	||�S)Nr>���r)	r6r3r,r.r!r)r+r�r5)
r�rGrRrSr�r�r�r�r�rZrLrLrM�	mpf_asinh�s

rcCsJ|d}t|t�dkrtd��ttt||�t|�|�}tt|||�||�S)NrrBz acosh(x) is real only for x >= 1)r'r!rr3r,r.r"r�)r�rGrRrSrZrLrLrM�	mpf_acosh�s
rcCs�|\}}}}|s|r|ttfvr|Std��||}|dkr0|dkr,|dkr,ttg|Std��|d}|dkrI||krDt||||�S||7}t|t|�}	tt||�}
t	t
t|	|
|�||�d�S)Nz&atanh(x) is real only for -1 <= x <= 1rrrrrB)r r&rr$r%r6r,r!r-r0r�r/)r�rGrRr�r�r�r�r�rSr[r\rLrLrM�	mpf_atanh�s$

rc
Cs�|\}}}}|s|tkrtS|St||�}|dkr.|dks$|t|�kr.ttt|��||�S||d}t|�}	tt	|	d�t
|�}
t|	||�}t||�}t
|||�}t|||�}t
||
||�}|S)NrrCr>r)r%r&r�rrr8r�mpf_phir,r0r"r��
mpf_cos_pir/r-)
r�rGrRr�r�r�r��sizerSr[r\r�rTrLrLrM�
mpf_fibonacci�s$
rcCs�|dkr
|}d}nd}td|d�}t|�|}td||�}ddt||�}||}|||K}t|>}|dk}	|tkr�|||?}
}|
|
|?}t}
}d}|r||d|}|
|7}
|d7}||d|}||7}|d7}|||?}|sW|
||?}|	r�||
|}n�||
|}n~td|d�}|||?}
}||
g}td|�D]
}|�|d|
|?�q�tg|}d}|r�t|�D]%}||d|}|	r�|d@r�|||8<n|||7<|d7}q�||d|?}|s�td|�D]}|||||?||<q�t|�|}|dk�r@t	||||>�}|�r*||}n||}t|�D]	}|||?}�q2||?S|d}t|�D]}|||?|}�qHt	t
||>||��}|�rf|}||?||?fS)	z�
    Taylor series for cosh/sinh or cos/sin.

    type = 0 -- returns exp(x)  (slightly faster than cosh+sinh)
    type = 1 -- returns (cosh(x), sinh(x))
    type = 2 -- returns (cos(x), sin(x))
    rr��?rCrAg333333�?rfrB)rFr�maxr�EXP_SERIES_U_CUTOFFrr�append�sumr7r�)r�rG�typer�rk�xmagr�rSr��altr�r[�x4r�r�r�r�r��xpowersr��sumsrorT�pshiftrLrLrM�exponential_series�sv  �

�

r*c
Cs�|tkr
t||d�St|d�}||7}t|>}}d}|||?}}|rF||}||7}|d7}||}||7}|d7}|||?}|s&|||?}||}|}	|r`|||?}|d8}|sT||	?S)z�
    Compute exp(x) as a fixed-point number. Works for any x,
    but for speed should have |x| < 1. For an arbitrary number,
    use exp(x) = exp(x-m*log(2)) * 2^m where m = floor(x/log(2)).
    rrrAr)�EXP_COSH_CUTOFFr*rFr)
r�rGrkr�r�r�r[r�ror�rLrLrM�exp_basecase>s(��r,cCsJ|tkrt||d�\}}||||fSt||�}t||>|}||fS)z(
    Computation of exp(x), exp(-x)
    r)r+r*r,r)r�rG�cosh�sinhr[r\rLrLrM�exp_expneg_basecaseWs
r/c
Cs4|tkr
t||d�S|t}||?}t|�}|tvr6|dtt>}t|dtd�\}}|d?|d?ft|<t|\}}t|}||L}||L}|||>8}t|>}	|}
d}|||?}|r�||}|	|7}	|d7}|||?}||}|
|7}
|d7}|||?}|s_|	||
||?|
||	||?fS)z�
    Compute cos(x), sin(x) as fixed-point numbers, assuming x
    in [0, pi/2). For an arbitrary number, use x' = x - m*(pi/2)
    where m = floor(x/(pi/2)) along with quarter-period symmetries.
    rArCr)�COS_SIN_CACHE_PRECr*�COS_SIN_CACHE_STEPrF�
cos_sin_cacher)
r�rG�precsr�r��w�cos_t�sin_t�offsetr�r�r�r[rLrLrM�cos_sin_basecasebs.$&�(r8cCs0|\}}}}|r�||}|d}|r|}|dkr0|dkr0t|td|��}	t|	||>||�S||kr<tt|||�S|dkrj||}
||
}|dkrQ||>}n||?}t|
�}
t||
�\}}t|�}||L}n||}|dkrw||>}n||?}d}t||�}t|||||�S|s�tS|t	kr�t
S|S)N�r:rg333333�?r)�mpf_erFr2r6r!rw�divmodr,rr%r )r�rGrRr�r�r�r�r�rS�e�wpmodr7r��lg2r�rLrLrMr�sB






r�cCs<|\}}}}|s.|r.|r|tkrtS|tkrtStS|tkr"ttfS|tkr*ttfSttfS||}|d}	|dkra||	kr\|rJt|d|||�Sttd||�}
t||||�}|
|fS|	|7}	|dkr�dd|d>|	kr�|r~tttg|d|||�Sttt|�||�d�}}
|r�t	|
�}
||
fS|dkr�|	|}||}|dkr�||>}n||?}t
|�}t||�\}}t|�}||L}n||	}|dkr�||>}n||?}d}t
||	�\}}||d|?}
||d|?}|r�|}|�r||	>|
}t||	||�St|
||	d||�}
t|||	d||�}|
|fS)	z4Simultaneously compute (cosh(x), sinh(x)) for real xr9���rrrCrXrBrA)r$r!r%r"r&r6r0r�r)r+rwr;rFr/r)r�rGrR�tanhr�r�r�r�r�rSr-r.r�ror=r7r�r>r�r[r\rLrLrM�
mpf_cosh_sinh�sj






rAcCs�|dkrZd}	d|>}|||}t|d�}|d?}||}	|	dkr(||	>}
n||	?}
t|
|�\}}||kr=||}
n|}
|
||d?rTt|�}||?}
||}n|d7}qn||7}||}	|	dkrl||	>}
n||	?}
d}|
||fS)Nrrr>rC)r�r;rF)r�r�r�rSr��cancellation_precr=�pi2�pi4r7r�r�r��smallrLrLrM�mod_pi2�s<


�



rFcCs�|\}}}}|s/|rtt}	}
ntt}	}
|dkr|	|
fS|dkr#|	S|dkr)|
S|dkr/|
S||}|d}|dkrx||krx|rIt|t|��}ttd||�}	t|d|||�}
|dkra|	|
fS|dkrg|	S|dkrm|
S|dkrxt||||�S|r�|dkr�|dkr�t}	ttft|d@�|A}
n|dkr�tt}	}
ntt}	}
|dkr�|	|
fS|dkr�|	S|dkr�|
S|dkr�t|
|	||�S||d?dd?}
||
|d>}t	|�|}|d|}||}|dkr�||>}n||?}|t
|�|?}n
t||||�\}}
}t||�\}	}
|
d@}|dk�r|
|	}	}
n|dk�r(|	|
}	}
n|dk�r3|
|	}	}
|�r9|
}
|dk�rRt
|	|||�}	t
|
|||�}
|	|
fS|dk�r_t
|	|||�S|dk�rlt
|
|||�S|dk�rxt|
|	||�SdS)z�
    which:
    0 -- return cos(x), sin(x)
    1 -- return cos(x)
    2 -- return sin(x)
    3 -- return tan(x)

    if pi=True, compute for pi*x
    rrrArXrCrBN)r&r!r r.r�r6r"�boolr/rr�rFr8rr)r�rGrR�which�pir�r�r�r�r�ror�rSr��mag2r7r�r_rLrLrM�mpf_cos_sinsz









�rKcC�t|||d�S�Nr�rK�r�rGrRrLrLrM�mpf_cosb�rPcCrL)NrArNrOrLrLrM�mpf_sincrQrRcCrL)NrXrNrOrLrLrM�mpf_tandrQrScC�t|||dd�S)NrrrNrOrLrLrM�mpf_cos_sin_pie�rUcCst|||dd�SrMrNrOrLrLrMrfrVrcCrT)NrArrNrOrLrLrM�
mpf_sin_pigrVrWcC�t|||�dS�Nr�rArOrLrLrM�mpf_coshhrVr[cCrXrMrZrOrLrLrM�mpf_sinhirVr\cCst|||dd�S)Nr)r@rZrOrLrLrM�mpf_tanhjrVr]cCs�|dur
t|d�}t||�\}}t|�}t||�\}}|d@}|dkr(||fS|dkr1||fS|dkr;||fS|dkrD||fSdS)NrrXrrA)r�r;rFr8)r�rGrCr�r�r�ror_rLrLrMr�osr�cCsJ|durt|�}t||�\}}t|�}t||�}|dkr ||>S||?SrY)rwr;rFr,)r�rGr�r�r�rTrLrLrM�	exp_fixed{s

r^�sagez)Warning: Sage imports in libelefun failed)F)FNr�)r)�rPrgr�backendrrrrrr	r
�libmpfrrr
rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7�
libintmathr8r+r r0r1r2r�r�r�r�r�r�rr�r�r�r�r�rQrWrYrlrprwr}r�r�r�r�r�r�r�r�r�r�rr�r:�
mpf_degree�mpf_ln2�mpf_ln10r�r��
mpf_sqrtpi�mpf_ln_sqrt2pir�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrrrrrr*r,r/r8r�rArFrKrPrRrSrUrrWr[r\r]r�r^�sage.libs.mpmath.ext_libmp�libs�mpmath�	ext_libmp�_lbmp�ImportError�AttributeErrorr�rLrLrLrM�<module>s� �
&	
	





	6S

/""H,##
K-C$O


��

Youez - 2016 - github.com/yon3zu
LinuXploit