Ë
    3^(h,Á  ã                   ó²  — d Z dZddlZddlZddlmZ ddlmZmZ ddl	m
Z
 ddl
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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(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^mZ dd	l	m_Z_ dd
l	m`Z` eajÄ                  Zc ejÈ                  d«      Zeedk(  rddlfmgZh ddlfmic mjc mkZl nddlmmnZh ddl	mmZl ddlmmoZompZpmqZq  G d„ dehe«      Zr G d„ d«      Zsetdk(  rddluZu eujì                  «        yy)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  — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd8d
„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zed„ «       Zed„ «       Zd9d„Zd9d„Zd9d„Zd9d„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	 d6gdfd7„Z7y)=Ú	MPContextzH
    Context for multiprecision arithmetic with a global precision.
    c                 óò  — t        j                  | «       d| _        d| _        | j                  | j
                  | j                  g| _        t        j                  | _
        | j                  «        t        j                  | «       t        j                  | _	        | 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 �Œw xY w©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    úK/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/mpmath/ctx_mp.pyrk   zMPContext.__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É5I6c                 óä  — | j                   }| j                  }| j                  t        «      | _        | j                  t
        «      | _        | j                  t
        t        f«      | _        | j                  t        «      | _
        | j                  t        «      | _        | j                  t        «      | _        | j                  d„ dd«      }|| _        | j                  t"        dd«      | _        | j                  t&        dd«      | _        | j                  t*        dd«      | _        | j                  t.        d	d
«      | _        | j                  t2        dd«      | _        | j                  t6        dd«      | _        | j                  t:        dd«      | _        | j                  t>        dd«      | _         | j                  tB        dd«      | _"        | j                  tF        dd«      | _$        | j                  tJ        dd«      | _&        | j                  tN        dd«      | _(        | j                  tR        dd«      | _*        | jW                  tX        jZ                  tX        j\                  «      | _/        | jW                  tX        j`                  tX        jb                  «      | _2        | jW                  tX        jf                  tX        jh                  «      | _5        | jW                  tX        jl                  tX        jn                  «      | _8        | jW                  tX        jr                  tX        jt                  «      | _;        | jW                  tX        jx                  tX        jz                  «      | _>        | jW                  tX        j~                  tX        j€                  «      | _A        | jW                  tX        j„                  tX        j†                  «      | _D        | jW                  tX        jŠ                  tX        jŒ                  «      | _G        | jW                  tX        j�                  tX        j’                  «      | _J        | jW                  tX        j–                  tX        j˜                  «      | _M        | jW                  tX        jœ                  tX        jž                  «      | _P        | jW                  tX        j¢                  tX        j¤                  «      | _S        | jW                  tX        j¨                  tX        jª                  «      | _V        | jW                  tX        j®                  tX        j°                  «      | _Y        | jW                  tX        jl                  tX        jn                  «      | _8        | jW                  tX        j´                  tX        j¶                  «      | _\        | jW                  tX        jº                  tX        j¼                  «      | __        | jW                  tX        jÀ                  tX        jÂ                  «      | _b        | jW                  tX        jÆ                  tX        jÈ                  «      | _e        | jW                  tX        jÌ                  tX        jÎ                  «      | _h        | jW                  tX        jÒ                  tX        jÔ                  «      | _k        | jW                  tX        jØ                  tX        jÚ                  «      | _n        | jW                  tX        jÞ                  tX        jà                  «      | _q        | jW                  tX        jä                  tX        jæ                  «      | _t        | jW                  tX        jê                  tX        jì                  «      x| _w        | _x        | jW                  tX        jò                  tX        jô                  «      | _{        | jW                  tX        jø                  tX        jú                  «      | _~        | jW                  tX        jþ                  tX        �j                   «      | _�        | jW                  tX        �j                  tX        �j                  «      x| _„        | _…        | jW                  tX        �j                  tX        �j                  «      | _ˆ        | jW                  tX        �j                  tX        �j                  «      | _‹        | jW                  tX        �j                  tX        �j                  «      | _Ž        | jW                  tX        �j                  tX        �j                   «      | _‘        | jW                  tX        �j$                  tX        �j&                  «      | _”        | jW                  tX        �j*                  tX        �j,                  «      | _—        | jW                  tX        �j0                  tX        �j2                  «      | _š        | jW                  tX        �j6                  tX        �j8                  «      | _�        | jW                  tX        �j<                  tX        �j>                  «      | _         | jW                  tX        �jB                  d «      | _¢        | jW                  tX        �jF                  d «      | _¤        | jW                  tX        �jJ                  tX        �jL                  «      | _§        | jW                  tX        �jP                  tX        �jR                  «      | _ª        �tW        | d| j^                  «      | _/        �tW        | d| jv                  «      | _;        �tW        | d| jj                  «      | _5        �tW        | d | jŽ                  «      | _G        �tW        | d!| jˆ                  «      | _D        y )"Nc                 ó   — dt         d| z
  dfS )Nr   r   )r   )ÚprecÚrnds     r…   ú<lambda>z)MPContext.init_builtins.<locals>.<lambda>m   s   € ¨a´¸!¸D¹&À!Ð-D€ ó    zepsilon of working precisionÚepsÚpizln(2)Úln2zln(10)Úln10zGolden ratio phiÚphiz
e = exp(1)ÚezEuler's constantÚeulerzCatalan's constantÚcatalanzKhinchin's constantÚkhinchinzGlaisher's constantÚglaisherzApery's constantÚaperyz1 deg = pi / 180ÚdegreezTwin prime constantÚ	twinprimezMertens' constantÚmertensÚ
_sage_sqrtÚ	_sage_expÚ_sage_lnÚ	_sage_cosÚ	_sage_sin)¬rn   ro   Úmake_mpfr   Úoner    ÚzeroÚmake_mpcÚjr!   Úinfr"   Úninfr#   Únanrp   rŒ   rP   r�   rT   rŽ   rU   r�   rS   r�   rR   r‘   rV   r’   rW   r“   rY   r”   rZ   r•   rX   r–   rQ   r—   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„   rn   ro   rŒ   s       r…   ru   zMPContext.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…   r9   zMPContext.to_fixed¶   s   € Ø�z‰z˜$ÓÐr‹   c                 óÎ   — | j                  |«      }| j                  |«      }| j                  t        j                  |j                  |j                  g| 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…   ÚhypotzMPContext.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                  |«      «      }|dk(  r| j                  |«      S t        |d«      st        ‚| j
                  \  }}t        j                  ||j                  ||d¬«      \  }}|€| j                  |«      S | j                  ||f«      S )Nr   r*  T)rô   )ÚintÚ_rer	  ÚhasattrÚNotImplementedErrorr+  r   Ú
mpf_expintr*  rŸ   r¢   ©r„   ÚnÚzrˆ   ÚroundingÚrealÚimags          r…   Ú_gamma_upper_intzMPContext._gamma_upper_intÁ   sŽ   € Ü�—‘˜“
‹OˆØ�Š6Ø—6‘6˜!“9ÐÜ�q˜'Ô"Ü%Ð%Ø×+Ñ+‰ˆˆhÜ×%Ñ% a¨¯©°$¸ÈÔM‰
ˆˆdØˆ<Ø—<‘< Ó%Ð%à—<‘<  t Ó-Ð-r‹   c                 ó  — t        |«      }|dk(  r| j                  |«      S t        |d«      st        ‚| j                  \  }}t        j                  ||j                  ||«      \  }}|€| j                  |«      S | j                  ||f«      S )Nr   r*  )
r/  r	  r1  r2  r+  r   r3  r*  rŸ   r¢   r4  s          r…   Ú_expint_intzMPContext._expint_intÎ   s„   € Ü�‹FˆØ�Š6Ø—6‘6˜!“9ÐÜ�q˜'Ô"Ü%Ð%Ø×+Ñ+‰ˆˆhÜ×%Ñ% a¨¯©°$¸ÓA‰
ˆˆdØˆ<Ø—<‘< Ó%Ð%à—<‘<  t Ó-Ð-r‹   c                 óx  — t        |d«      r;	 | j                  t        j                  |j                  |g| j
                  ¢­Ž «      S |j                  }| j                  t        j                  ||g| j
                  ¢­Ž «      S # t        $ r, | j                  r‚ |j                  t        j                  f}Y Œdw xY w©Nr*  )r1  rŸ   r   Úmpf_nthrootr*  r+  r   rl   r    Ú_mpc_r¢   Úmpc_nthroot©r„   r&  r5  s      r…   Ú_nthrootzMPContext._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Â8B9c                 ó  — | j                   \  }}t        |d«      r1| j                  t        j                  ||j
                  ||«      «      S t        |d«      r1| j                  t        j                  ||j                  ||«      «      S y ©Nr*  r@  )	r+  r1  rŸ   r   Úmpf_besseljnr*  r¢   Úmpc_besseljnr@  )r„   r5  r6  rˆ   r7  s        r…   Ú_besseljzMPContext._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>	 t        j                  |j                  |j                  ||«      }| j                  |«      S t        |d«      r|j                  t        j                  f}n|j                  }t        |d«      r|j                  t        j                  f}n|j                  }| j                  t        j                  ||||«      «      S # t        $ r Y Œœw xY wr>  )r+  r1  r   Úmpf_agmr*  rŸ   r   r    r@  r¢   Úmpc_agm)r„   ÚaÚbrˆ   r7  Úvs         r…   Ú_agmzMPContext._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ÄDc                 ór   — | j                  t        j                  t        |«      g| j                  ¢­Ž «      S r%  )rŸ   r   Úmpf_bernoullir/  r+  ©r„   r5  s     r…   rx   zMPContext.bernoulliü   s+   € Ø�|‰|œE×/Ñ/´°A³ÐL¸×9KÑ9KÒLÓMÐMr‹   c                 ór   — | j                  t        j                  t        |«      g| j                  ¢­Ž «      S r%  )rŸ   r   Úmpf_zeta_intr/  r+  rR  s     r…   Ú	_zeta_intzMPContext._zeta_intÿ   s+   € Ø�|‰|œE×.Ñ.¬s°1«vÐK¸×8JÑ8JÒKÓLÐLr‹   c                 óÎ   — | j                  |«      }| j                  |«      }| j                  t        j                  |j                  |j                  g| j
                  ¢­Ž «      S r%  )r(  rŸ   r   Ú	mpf_atan2r*  r+  )r„   r,  r&  s      r…   r}   zMPContext.atan2  sI   € Ø�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:| j                  t	        j
                  ||j                  g| j                  ¢­Ž «      S | j                  t	        j                  ||j                  g| j                  ¢­Ž «      S r%  )r(  r/  Ú_is_real_typerŸ   r   Úmpf_psir*  r+  r¢   Úmpc_psir@  )r„   Úmr6  s      r…   r|   zMPContext.psi  sx   € Ø�K‰K˜‹NˆÜ�‹FˆØ×Ñ˜QÔØ—<‘<¤§¡¨a°·±Ð N¸3×;MÑ;MÒ NÓOÐOà—<‘<¤§¡¨a°·±Ð N¸3×;MÑ;MÒ NÓOÐOr‹   c                 ó  — t        |«      | j                  vr| j                  |«      }| j                  |«      \  }}t	        |d«      rFt        j                  |j                  ||«      \  }}| j                  |«      | j                  |«      fS t	        |d«      rFt        j                  |j                  ||«      \  }}| j                  |«      | j                  |«      fS  | j                  |fi |¤Ž | j                  |fi |¤ŽfS rE  )Útyperq   r(  Ú_parse_precr1  r   Úmpf_cos_sinr*  rŸ   Úmpc_cos_sinr@  r¢   rÂ   r¿   ©r„   r&  Úkwargsrˆ   r7  ÚcÚss          r…   Úcos_sinzMPContext.cos_sin  sÞ   € Ü�‹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        |«      | j                  vr| j                  |«      }| j                  |«      \  }}t	        |d«      rFt        j                  |j                  ||«      \  }}| j                  |«      | j                  |«      fS t	        |d«      rFt        j                  |j                  ||«      \  }}| j                  |«      | j                  |«      fS  | j                  |fi |¤Ž | j                  |fi |¤ŽfS rE  )r^  rq   r(  r_  r1  r   Úmpf_cos_sin_pir*  rŸ   Úmpc_cos_sin_pir@  r¢   rÂ   r¿   rb  s          r…   Úcospi_sinpizMPContext.cospi_sinpi  sÞ   € Ü�‹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„   rL  s     r…   ÚclonezMPContext.clone)  s   € ð �M‰M‹OˆØ—‘ˆŒØˆr‹   c                 ó@   — t        |d«      st        |«      t        u ryy)Nr@  FT©r1  r^  Úcomplex©r„   r&  s     r…   rY  zMPContext._is_real_type4  s   € Ü�1�gÔ¤$ q£'¬WÑ"4ØØr‹   c                 ó@   — t        |d«      st        |«      t        u ryy)Nr@  TFro  rq  s     r…   Ú_is_complex_typezMPContext._is_complex_type9  s   € Ü�1�gÔ¤$ q£'¬WÑ"4ØØr‹   c                 ó\  — t        |d«      r|j                  t        k(  S t        |d«      rt        |j                  v S t	        |t
        «      st	        |t        j                  «      ry| j                  |«      }t        |d«      st        |d«      r| j                  |«      S t        d«      ‚)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@  Fzisnan() needs a number as input)r1  r*  r#   r@  Ú
isinstancer   r^   rr   r(  ÚisnanÚ	TypeErrorrq  s     r…   rv  zMPContext.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                  |«      ryy)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)Úisinfrv  rq  s     r…   ÚisfinitezMPContext.isfiniteZ  s   € ð, �9‰9�QŒ<˜3Ÿ9™9 Qœ<ØØr‹   c                 ó”  — |syt        |d«      r|j                  \  }}}}|xr |dk\  S t        |d«      r*|j                   xr | j                  |j                  «      S t        |«      t        v r|dk  S t        || j                  «      r|j                  \  }}|sy|dk(  xr |dk  S | j                  | j                  |«      «      S )z<
        Determine if *x* is a nonpositive integer.
        Tr*  r   r@  r   )r1  r*  r9  Úisnpintr8  r^  r   ru  rr   Ú_mpq_r(  )r„   r&  ÚsignÚmanr¶   ÚbcÚpÚqs           r…   r|  zMPContext.isnpintt  s½   € ñ ØÜ�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                 óê   — dd| j                   z  j                  d«      dz   d| j                  z  j                  d«      dz   d| j                  z  j                  d«      dz   g}d	j	                  |«      S )
NzMpmath 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__zMPContext.__str__ˆ  st   € Ø#Ø §¡Ñ(×/Ñ/°Ó3°oÑEØ˜sŸw™wÑ&×-Ñ-¨bÓ1°OÑCØ%¨×(8Ñ(8Ñ8×?Ñ?ÀÓCÐFXÑXð
ˆð
 �y‰y˜ÓÐr‹   c                 ó,   — t        | j                  «      S r%  )r   Ú_precrƒ   s    r…   Ú_repr_digitszMPContext._repr_digits�  s   € ä˜Ÿ	™	Ó"Ð"r‹   c                 ó   — | j                   S r%  )Ú_dpsrƒ   s    r…   Ú_str_digitszMPContext._str_digits”  s   € à�x‰xˆr‹   Fc                 ó&   ‡— t        | ˆfd„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                 ó   •— | ‰z   S r%  © ©r�  r5  s    €r…   rŠ   z%MPContext.extraprec.<locals>.<lambda>¨  s   ø€ ¨q°1©u€ r‹   N©ÚPrecisionManager©r„   r5  Únormalize_outputs    ` r…   Ú	extrapreczMPContext.extraprec˜  s   ø€ ô    £_°dÐ<LÓMÐMr‹   c                 ó&   ‡— t        | dˆfd„|«      S )z–
        This function is analogous to extraprec (see documentation)
        but changes the decimal precision instead of the number of bits.
        Nc                 ó   •— | ‰z   S r%  r“  ©Údr5  s    €r…   rŠ   z$MPContext.extradps.<locals>.<lambda>¯  s   ø€ °Q¸±U€ r‹   r•  r—  s    ` r…   ÚextradpszMPContext.extradpsª  s   ø€ ô
    T«?Ð<LÓMÐMr‹   c                 ó&   ‡— t        | ˆfd„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                 ó   •— ‰S r%  r“  r”  s    €r…   rŠ   z$MPContext.workprec.<locals>.<lambda>À  s   ø€ ¨q€ r‹   Nr•  r—  s    ` r…   ÚworkpreczMPContext.workprec±  s   ø€ ô   £[°$Ð8HÓIÐIr‹   c                 ó&   ‡— t        | dˆfd„|«      S )z•
        This function is analogous to workprec (see documentation)
        but changes the decimal precision instead of the number of bits.
        Nc                 ó   •— ‰S r%  r“  rœ  s    €r…   rŠ   z#MPContext.workdps.<locals>.<lambda>Ç  s   ø€ °Q€ r‹   r•  r—  s    ` r…   ÚworkdpszMPContext.workdpsÂ  s   ø€ ô
    T«;Ð8HÓIÐIr‹   Nc                 ó"   ‡ ‡‡‡‡— ˆˆ ˆˆˆfd„}|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‰}	 |dz   ‰	_         	  ‰
| i |¤Ž}|dz   }	 |‰	_         	  ‰
| i |¤Ž}||k(  rn}‰	j                  ||z
  «      ‰	j                  |«      z
  }|| k  rnP‰rt	        d|›d|›d| ›�«       |}||k\  r‰	j                  d|z  «      ‚|t        |dz  «      z  }t        ||«      }Œ“|‰	_         |­S # ‰$ r ‰	j                  }Y Œ¶w xY w# ‰$ r ‰	j                  }Y Œ·w xY w# |‰	_         w xY w)Né
   é   zautoprec: target=z, prec=z, accuracy=z2autoprec: prec increased to %i without convergenceé   )rˆ   Ú_default_hyper_maxprecr¦   ÚmagÚprintÚNoConvergencer/  Úmin)Úargsrc  rˆ   Ú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 ÁBD	 ÃC/Ã,D	 Ã.C/Ã/D	 Ã2DÄD	 ÄDÄD	 Ä		Dr“  )r„   r¶  r·  rµ  r¸  r¹  s   ````` r…   ÚautopreczMPContext.autoprecÉ  s   ü€ ÷H$	ð $	ðJ "Ð!r‹   c                 óú  ‡ ‡‡— t        |t        «      rddj                  ˆ ˆˆfd„|D «       «      z  S t        |t        «      rddj                  ˆ ˆˆfd„|D «       «      z  S t	        |d«      rt        |j                  ‰fi ‰¤ŽS t	        |d«      rdt        |j                  ‰fi ‰¤Žz   d	z   S t        |t        «      rt        |«      S t        |‰ j                  «      r |j                  ‰fi ‰¤ŽS t        |«      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, c              3   óF   •K  — | ]  } ‰j                   |‰fi ‰¤Ž–— Œ y ­wr%  ©Únstr©Ú.0rd  r„   rc  r5  s     €€€r…   ú	<genexpr>z!MPContext.nstr.<locals>.<genexpr>]  ó#   øè ø€ Ò&KÀA x s§x¡x°°1Ñ'?¸Õ'?Ñ&Kùó   ƒ!z(%s)c              3   óF   •K  — | ]  } ‰j                   |‰fi ‰¤Ž–— Œ y ­wr%  r½  r¿  s     €€€r…   rÁ  z!MPContext.nstr.<locals>.<genexpr>_  rÂ  rÃ  r*  r@  ú(ú))ru  Úlistrˆ  Útupler1  r   r*  r:   r@  r   ÚreprÚmatrixÚ__nstr__Ústr)r„   r&  r5  rc  s   ` ``r…   r¾  zMPContext.nstr4  sØ   ú€ ô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                  «       v rš|j                  «       j                  dd«      }t        j                  |«      }|j                  d«      }|sd}|j                  d«      j                  d«      }| j                  | j                  |«      | j                  |«      «      S t        |d«      r0|j                  \  }}||k(  r| j                  |«      S t        d«      ‚t        d	t        |«      z   «      ‚)
Nr£   ú Ú Úrer   ÚimÚ_mpi_z,can only create mpf from zero-width intervalzcannot create mpf from )ru  r   ÚlowerÚreplaceÚget_complexÚmatchÚgroupÚrstripro   r(  r1  rÒ  rŸ   Ú
ValueErrorrw  rÉ  )r„   r&  ÚstringsrÖ  rÐ  rÑ  rL  rM  s           r…   Ú_convert_fallbackzMPContext._convert_fallbackj  sá   € Ù”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 |¤ŽS r%  )r(  )r„   r¯  rc  s      r…   Ú	mpmathifyzMPContext.mpmathify|  s   € Øˆs�{‰{˜DÐ+ FÑ+Ð+r‹   c                 ó  — |rz|j                  d«      ry| j                  \  }}d|v r|d   }d|v r$|d   }|| j                  k(  ryt        |«      }||fS d|v r |d   }|| j                  k(  ryt	        |«      }||fS | j                  S )NÚexact)r   r¶  r7  rˆ   r‡  )Úgetr+  r¤   r/  r   )r„   rc  rˆ   r7  r‡  s        r…   r_  zMPContext._parse_prec  s©   € ÙØ�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|||df}|j                  }	nt        |d«      r|||df}|j                  }	| j                  vr%t	        j
                  |«      d   | j                  |<   | j                  |   }
| j                  }|j                  d| j                  |«      «      }d}d}i }d	}t        |«      D ]½  \  }}||   d
k(  rG||k\  rA|d	k  r<d}t        |d | «      D ]  \  }}||   d
k(  sŒ|d	k  sŒ||k  sŒd}Œ |st        d«      ‚ŒU| j                  |«      \  }}t        |«       }| }||k\  r3|d	k\  r.|dkD  r)||v r||xx   |z  cc<   n|||<   t        |||z
  dz   «      }|t        |«      z  }Œ¿ 	 ||kD  rt        | j                   |||z   fz  «      ‚||z   }|rt#        d„ |D «       «      }ni } |
|	||||fi |¤Ž\  }}}| }d}||k  r |j%                  «       D ]  }|�||k  sŒd} n ||dz
  dz
  k  xs | }|r:|rnG|j                  d«      } | �$|| kD  r|r| j'                  d	«      S | j(                  S |dz  }|dz  }|dz  }ŒÖt+        |«      t,        u r$|r| j/                  |«      S | j1                  |«      S |S )Nr*  ÚRr@  ÚCr   r·  é2   é   r   ÚZFTzpole in hypergeometric seriesé   é<   c              3   ó$   K  — | ]  }|d f–— Œ
 y ­wr%  r“  )rÀ  r5  s     r…   rÁ  z#MPContext.hypsum.<locals>.<genexpr>Ç  s   è ø€ ÒB¨Q  4¤ÑBùs   ‚é   Úzeroprecr©  )r1  r*  r@  rv   r   Úmake_hyp_summatorrˆ   rà  rª  Ú	enumerateÚZeroDivisionErrorÚnint_distancer/  ÚmaxÚabsrÙ  Ú_hypsum_msgÚdictÚvaluesro   r¡   r^  rÈ  r¢   rŸ   )!r„   r�  r‚  ÚflagsÚcoeffsr6  Úaccurate_smallrc  ÚkeyrN  Úsummatorrˆ   r·  r™  ÚepsshiftÚmagnitude_checkÚmax_total_jumpÚird  ÚokÚiiÚccr5  r�  ÚwpÚmag_dictÚzvÚhave_complexÚ	magnitudeÚcancelÚjumps_resolvedÚaccuraterë  s!                                    r…   ÚhypsumzMPContext.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                  |«      }| j                  t        j                  |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*  rB  s      r…   ÚldexpzMPContext.ldexpï  s/   € ð �K‰K˜‹NˆØ�|‰|œEŸO™O¨A¯G©G°QÓ7Ó8Ð8r‹   c                 óŽ   — | j                  |«      }t        j                  |j                  «      \  }}| j	                  |«      |fS )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,  r5  s       r…   ÚfrexpzMPContext.frexp   s:   € ð �K‰K˜‹NˆÜ�‰˜qŸw™wÓ'‰ˆˆ1Ø�|‰|˜A‹ Ð!Ð!r‹   c                 ó*  — | j                  |«      \  }}| j                  |«      }t        |d«      r&| j                  t	        |j
                  ||«      «      S t        |d«      r&| j                  t        |j                  ||«      «      S t        d«      ‚)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(  r1  rŸ   r&   r*  r¢   r?   r@  rÙ  )r„   r&  rc  rˆ   r7  s        r…   ÚfnegzMPContext.fneg  s|   € ð\ Ÿ™¨Ó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| j                  t	        |j
                  |j
                  ||«      «      S t        |d«      r1| j                  t        |j                  |j
                  ||«      «      S t        |d«      rzt        |d«      r1| j                  t        |j                  |j
                  ||«      «      S t        |d«      r1| j                  t        |j                  |j                  ||«      «      S t        d«      ‚# t        t        f$ r t        | j                  «      ‚w xY w)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(  r1  rŸ   r'   r*  r¢   rC   r@  rB   rÙ  ÚOverflowErrorÚ_exact_overflow_msg©r„   r&  r,  rc  rˆ   r7  s         r…   ÚfaddzMPContext.faddF  s/  € ð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úó   ¸AE Â<E Â>AE Ä<E Å%E4c                 óú  — | j                  |«      \  }}| j                  |«      }| j                  |«      }	 t        |d«      r€t        |d«      r1| j                  t	        |j
                  |j
                  ||«      «      S t        |d«      r7| j                  t        |j
                  t        f|j                  ||«      «      S t        |d«      rzt        |d«      r1| j                  t        |j                  |j
                  ||«      «      S t        |d«      r1| j                  t        |j                  |j                  ||«      «      S t        d«      ‚# t        t        f$ r t        | j                  «      ‚w xY w)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(  r1  rŸ   r(   r*  r¢   rD   r    r@  rE   rÙ  r  r  r  s         r…   ÚfsubzMPContext.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    ¸AE ÂAE ÃAE Ä<E Å%E:c                 óî  — | j                  |«      \  }}| j                  |«      }| j                  |«      }	 t        |d«      rzt        |d«      r1| j                  t	        |j
                  |j
                  ||«      «      S t        |d«      r1| j                  t        |j                  |j
                  ||«      «      S t        |d«      rzt        |d«      r1| j                  t        |j                  |j
                  ||«      «      S t        |d«      r1| j                  t        |j                  |j                  ||«      «      S t        d«      ‚# t        t        f$ r t        | j                  «      ‚w xY w)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(  r1  rŸ   r)   r*  r¢   rG   r@  rF   rÙ  r  r  r  s         r…   ÚfmulzMPContext.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úr  c                 óÂ  — | j                  |«      \  }}|st        d«      ‚| j                  |«      }| j                  |«      }t        |d«      r€t        |d«      r1| j	                  t        |j                  |j                  ||«      «      S t        |d«      r7| j                  t        |j                  t        f|j                  ||«      «      S t        |d«      rzt        |d«      r1| j                  t        |j                  |j                  ||«      «      S t        |d«      r1| j                  t        |j                  |j                  ||«      «      S t        d«      ‚)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(  r1  rŸ   r+   r*  r¢   rI   r    r@  rJ   r  s         r…   ÚfdivzMPContext.fdiv  s  € ð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        |«      }|t        v rt        |«      | j                  fS |t        j
                  u rf|j                  \  }}t        ||«      \  }}d|z  |k\  r|dz  }n|s|| j                  fS t        t        |||z  z
  «      «      t        |«      z
  }||fS t        |d«      r|j                  }| j                  }	n�t        |d«      r?|j                  \  }}
|
\  }}}}|r||z   }	nf|
t        k(  r| j                  }	nPt        d«      ‚| j                  |«      }t        |d«      st        |d«      r| j!                  |«      S t#        d«      ‚|\  }}}}||z   }|dk  rd}|}n‹|rf|dk\  r||z  }| j                  }nI|dk(  r|dz	  dz   }d}n9| dz
  }||z	  }|dz  r|dz  }||z  |z
  }n|||z  z  }|dz	  }|t        |«      z   }|r'| }n#|t        k(  r| j                  }d}nt        d«      ‚|t%        ||	«      fS )	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©  r   r*  r@  zrequires a finite numberzrequires an mpf/mpcr   éÿÿÿÿ)r^  r   r/  r¥   r^   rr   r}  Údivmodr8   rñ  r1  r*  r@  r    rÙ  r(  rï  rw  rð  )r„   r&  Útypxr�  r‚  r5  Úrr�  rÐ  Úim_distrÑ  ÚisignÚimanÚiexpÚibcr~  r  r¶   r€  r«  Úre_distÚts                         r…   rï  zMPContext.nint_distanceY  s3  € ô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 # || _         w xY w)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ÚorigrN  r�  s        r…   ÚfprodzMPContext.fprod»  sN   € ð �x‰xˆð	Ø—‘ˆAØò �Ø�Q‘‘ñð ˆCŒHØˆrˆ	øð ˆC�Hús   Ž1 ±	:c                 óJ   — | j                  t        | 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Ÿ   r6   rŒ  rƒ   s    r…   ÚrandzMPContext.randÐ  s   € ð �|‰|œH S§Y¡YÓ/Ó0Ð0r‹   c                 ó<   ‡‡— | j                  ˆˆfd„‰›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        ‰‰| |«      S r%  )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…   ÚfractionzMPContext.fractionØ  s!   ù€ ð$ �|‰|ÔLÚ™!Ðóð 	r‹   c                 ó6   — t        | j                  |«      «      S r%  ©rñ  r(  rq  s     r…   ÚabsminzMPContext.absminí  ó   € Ü�3—;‘;˜q“>Ó"Ð"r‹   c                 ó6   — t        | j                  |«      «      S r%  r6  rq  s     r…   ÚabsmaxzMPContext.absmaxð  r8  r‹   c                 ó€   — t        |d«      r1|j                  \  }}| j                  |«      | j                  |«      gS |S )NrÒ  )r1  rÒ  rŸ   )r„   r&  rL  rM  s       r…   Ú
_as_pointszMPContext._as_pointsó  s9   € ä�1�gÔØ—7‘7‰DˆAˆqØ—L‘L “O S§\¡\°!£_Ð5Ð5Øˆr‹   r   c                 óX  — | j                  |«      rt        |d«      st        ‚t        |«      }| j                  }t        j                  |j                  |||||«      \  }}|D �	cg c]  }	| j                  |	«      ‘Œ }}	|D �
cg c]  }
| j                  |
«      ‘Œ }}
||fS c c}	w c c}
w )Nr@  )	Úisintr1  r2  r/  rŒ  r   Úmpc_zetasumr@  r¢   )r„   re  rL  r5  ÚderivativesÚreflectrˆ   ÚxsÚysr&  r,  s              r…   Ú_zetasum_fastzMPContext._zetasum_fast  s—   € Ø—	‘	˜!”¤¨¨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__rk   ru   r9   r-  r:  r<  rC  rH  rO  rx   rU  r}   r|   rf  rj  rm  rY  rs  rv  rz  r|  rŠ  Úpropertyr�  r�  r™  rž  r¡  r¤  rº  r¾  rÛ  rÝ  r_  r  rò  r	  r  r  r  r  r  r  r  rï  r.  r0  r4  r7  r:  r<  rD  r“  r‹   r…   rg   rg   :   s\  „ ñò1òBT5òl òTò.ò.ò
JòPóAòNòMòTò
Pò>ò>òòò
ò
;ò8ò4+ò( ð ñ#ó ð#ð ñó ðóNó$NóJó"Jói"óV4òl=ò$,ò"ð* DÐð€KóSòj9ò""ò 4OòlHOòT@OòDCOòJ@OòD`(òDò*1òò*#ò#òðð" 23°¸Uô r‹   rg   c                   ó&   — e Zd Zdd„Zd„ Zd„ Zd„ Zy)r–  c                 ó<   — || _         || _        || _        || _        y r%  )r„   ÚprecfunÚdpsfunr˜  )Úselfr„   rN  rO  r˜  s        r…   rk   zPrecisionManager.__init__  s   € ØˆŒØˆŒØˆŒØ 0ˆÕr‹   c                 óF   ‡ ‡— t        j                  ‰«      ˆˆ fd„«       }|S )Nc                  óL  •— ‰j                   j                  }	 ‰j                  r5‰j                  ‰j                   j                  «      ‰j                   _        n4‰j                  ‰j                   j                  «      ‰j                   _        ‰j
                  rX ‰| i |¤Ž}t        |«      t        u r+t        |D �cg c]  }|­‘Œ c}«      |‰j                   _        S |­|‰j                   _        S  ‰| i |¤Ž|‰j                   _        S c c}w # |‰j                   _        w xY wr%  )r„   rˆ   rN  rO  r‡  r˜  r^  rÈ  )r¯  rc  r-  rN  rL  r¶  rP  s        €€r…   Úgz$PrecisionManager.__call__.<locals>.g  sÚ   ø€ à—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 Ã2D ÄD ÄD#)Ú	functoolsÚwraps)rP  r¶  rS  s   `` r…   Ú__call__zPrecisionManager.__call__  s%   ù€ Ü	�‰˜Ó	ô	%ó 
ð	%ð  ˆr‹   c                 ó$  — | j                   j                  | _        | j                  r5| j                  | j                   j                  «      | j                   _        y | j	                  | j                   j
                  «      | j                   _        y r%  )r„   rˆ   ÚorigprN  rO  r‡  )rP  s    r…   Ú	__enter__zPrecisionManager.__enter__.  sP   € Ø—X‘X—]‘]ˆŒ
Ø�<Š<Ø ŸL™L¨¯©¯©Ó7ˆD�H‰H�MàŸ;™; t§x¡x§|¡|Ó4ˆD�H‰H�Lr‹   c                 ó:   — | j                   | j                  _        yri   )rX  r„   rˆ   )rP  Úexc_typeÚexc_valÚexc_tbs       r…   Ú__exit__zPrecisionManager.__exit__4  s   € ØŸ
™
ˆ�‰ŒØr‹   NrE  )rG  rH  rI  rk   rV  rY  r^  r“  r‹   r…   r–  r–    s   „ ó1ò
ò&5ór‹   r–  Ú__main__)wrJ  Ú__docformat__rT  rÐ  Úctx_baser   Úlibmp.backendr   r   rÏ  r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   ÚobjectÚ__new__ÚnewÚcompilerÕ  Úsage.libs.mpmath.ext_mainr`   rj   ÚlibsÚmpmathÚext_mainÚ_mpf_modulerb   ra   rc   rd   re   rg   r–  rG  ÚdoctestÚtestmodr“  r‹   r…   ú<module>rn     s  ðñð €ã ã 	å )ç .å ÷÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ õ õ. Ý à‡n�n€àˆb�j‰jð Kó L€ð ˆfÒÝBç3Ô3å?Ý.ç 0Ñ 0ôY�Ð2ô Y÷v&!ñ !ðH ˆzÒÛØ€G‡O�OÕð r‹   