Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 18.118.195.241
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : test_math.pyc
�
?��cc@s�ddlmZmZddlZddlZddlZddlZddlZddlZdZ	e
d�Ze
d�Ze
d�Z
eje
jd�jd�d	�Zd
df\ZZeed
dkZed
kr�ejdZneZejje�pejZejjed�Zejjed�Zd�Z dd�Z!ddd�Z"d�Z#d�Z$dej%fd��YZ&d�Z'ed
kr�e'�ndS(i����(trun_unittesttverboseNg�h㈵��>tnantinfs-inftdoubletIEEEstest requires IEEE 754 doublesg��7y�ACg�):��@it__main__ismath_testcases.txtscmath_testcases.txtcCs@tjdtjd|��d}|dkr<|d}n|S(sVConvert a non-NaN float x to an integer, in such a way that
    adjacent floats are converted to adjacent integers.  Then
    abs(ulps(x) - ulps(y)) gives the difference in ulps between two
    floats.

    The results from this function will only make sense on platforms
    where C doubles are represented in IEEE 754 binary64 format.

    s<qs<diii?l(tstructtunpacktpack(txtn((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pytto_ulps$s
"icCs<t|�t|�}t|�|kr,dSdj||�S(s�Given non-NaN floats `expected` and `got`,
    check that they're equal to within the given number of ulps.

    Returns None on success and an error message on failure.s*error = {} ulps; permitted error = {} ulpsN(RtabstNonetformat(texpectedtgottulpst
ulps_error((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt
ulps_check3s
	gV瞯�<g
cCshtj|�r||krdS||}t||t|��}t|�|krXdSdj||�S(sDetermine whether non-NaN floats a and b are equal to within a
    (small) rounding error.  The default values for rel_err and
    abs_err are chosen to be suitable for platforms where a float is
    represented by an IEEE 754 double.  They allow an error of between
    9 and 19 ulps.s error = {}; permitted error = {}N(tmathtisinfRtmaxR
R(RRtrel_errtabs_errterrortpermitted_error((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt	acc_check?s
	c
cs�t|���}x�|D]�}d|kr>||jd� }n|j�sPqn|jd�\}}|j�\}}}|j�}|d}	|d}
||t|�t|	�|
fVqWWdQXdS(s�Parse a file with test values

    -- starts a comment
    blank lines, or lines containing only a comment, are ignored
    other lines are expected to have the form
      id fn arg -> expected [flag]*

    s--s->iiN(topentindextstriptsplittfloat(tfnametfptlinetlhstrhstidtfntargt
rhs_piecestexptflags((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pytparse_mtestfileRs	


c
cs�t|���}x�|D]�}|jd�s|j�r>qn|jd�\}}|j�\}}}}|j�}	|	d|	d}
}|	d}||t|�t|�t|
�t|�|fVqWWdQXdS(s�Parse a file with test values

    Empty lines or lines starting with -- are ignored
    yields id, fn, arg_real, arg_imag, exp_real, exp_imag
    s--s->iiiN(Rt
startswithRR R!(
R"R#R$R%R&R'R(targ_realtarg_imagR*texp_realtexp_imagR,((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pytparse_testfileks

t	MathTestscBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zed
��Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zeejed�d���Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d �Z%d!�Z&d"�Z'd#�Z(d$�Z)d%�Z*ej+e,d&�d'��Z-ed(��Z.ej+e/j0d)�j1d*�d+�d,��Z2RS(-cCs7t||�tkr3|jd|||f�ndS(Ns%s returned %r, expected %r(R
tepstfail(tselftnametvalueR((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pytftest�s	cCs0|jdtjd�|jdtjd�dS(NtpigJ�M�!	@tegB�
�@(R:RR;R<(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt
testConstants�scCs�|jttj�|jdtjd�tj�|jdtjd�tjd�|jdtjd�d�|jttjt�|jttjt�|j	tj
tjt���dS(Nsacos(-1)i����sacos(0)iisacos(1)i(tassertRaisest	TypeErrorRtacosR:R;t
ValueErrortINFtNINFt
assertTruetisnantNAN(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestAcos�s#cCs�|jttj�|jdtjd�d�|jdtjd�d�|jttjd�|jttjd�|jtjt�t�|jttjt�|j	tj
tjt���dS(Nsacosh(1)iisacosh(2)ig5�qB�?i����(R>R?RtacoshR:RAtassertEqualRBRCRDRERF(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt	testAcosh�scCs�|jttj�|jdtjd�tjd�|jdtjd�d�|jdtjd�tjd�|jttjt�|jttjt�|j	tj
tjt���dS(Nsasin(-1)i����isasin(0)isasin(1)i(R>R?RtasinR:R;RARBRCRDRERF(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestAsin�s$#cCs�|jttj�|jdtjd�d�|jdtjd�d�|jdtjd�d�|jtjt�t�|jtjt�t�|jtj	tjt
���dS(	Nsasinh(0)isasinh(1)ig'�ya64�?s	asinh(-1)i����g'�ya64�(R>R?RtasinhR:RIRBRCRDRERF(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt	testAsinh�scCs�|jttj�|jdtjd�tjd�|jdtjd�d�|jdtjd�tjd�|jdtjt�tjd	�|jd
tjt�tjd	�|jtj	tjt
���dS(Nsatan(-1)i����isatan(0)isatan(1)is	atan(inf)is
atan(-inf)(R>R?RtatanR:R;RBRCRDRERF(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestAtan�s$##$cCs�|jttj�|jdtjd�d�|jdtjd�d�|jdtjd�d�|jttjd	�|jttjd
�|jttjt�|jttjt�|j	tj
tjt���dS(Nsatanh(0)is
atanh(0.5)g�?g�z��?satanh(-0.5)g�g�z��ii����(R>R?RROR:tatanhRARBRCRDRERF(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt	testAtanh�scCs�|jttj�|jdtjdd�tjd�|jdtjdd�tjd�|jdtjdd�d�|jd	tjdd�tjd�|jd
tjdd�tjd�|jdtjdt�tj�|jd
tjdd�tj�|jdtjdd�tj�|jtjdd�d�|jtjdd�d�|jtjdt�d�|j	tj
tjdt���|jdtjdt�tj�|jdtjdd�tj�|jdtjdd�tj�|jtjdd�d�|jtjdd�d�|jtjdt�d�|j	tj
tjdt���|jdtjtt�tjdd�|jdtjtd�tjd�|jdtjtd�tjd�|jdtjtd�tjd�|jdtjtd�tjd�|jdtjtt�tjd�|j	tj
tjtt���|jdtjtt�tjdd�|jdtjtd�tjd�|jdtjtd�tjd�|jdtjtd�tjd�|jd tjtd�tjd�|jd!tjtt�tjd�|j	tj
tjtt���|jd"tjdt�tj�|jd#tjdd�tjd�|jd$tjdd�tjd�|jtjdt�d�|j	tj
tjdt���|jd%tjdt�tj�|jd&tjdd�tjd�|jd'tjdd�tjd�|jtjdt�d�|j	tj
tjdt���|j	tj
tjtt���|j	tj
tjtd���|j	tj
tjtd���|j	tj
tjtd���|j	tj
tjtd���|j	tj
tjtt���|j	tj
tjtt���dS((Nsatan2(-1, 0)i����iisatan2(-1, 1)iisatan2(0, 1)satan2(1, 1)satan2(1, 0)satan2(0., -inf)gsatan2(0., -2.3)gffffff�satan2(0., -0.)g�gffffff@satan2(-0., -inf)satan2(-0., -2.3)satan2(-0., -0.)satan2(inf, -inf)isatan2(inf, -2.3)satan2(inf, -0.)satan2(inf, 0.)satan2(inf, 2.3)satan2(inf, inf)satan2(-inf, -inf)satan2(-inf, -2.3)satan2(-inf, -0.)satan2(-inf, 0.)satan2(-inf, 2.3)satan2(-inf, inf)satan2(2.3, -inf)satan2(2.3, -0.)satan2(2.3, 0.)satan2(-2.3, -inf)satan2(-2.3, -0.)satan2(-2.3, 0.)(R>R?Rtatan2R:R;RCRIRBRDRERF(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt	testAtan2�sf''&&""""###"*&&&&&"+'''''""&&"#''"""""""cCs|jttj�|jtttjd���|jtttjd���|jtttjd���|jdtjd�d�|jdtjd�d�|jdtjd�d	�|jd
tjd�d�|jd
tjd�d�|jdtjd�d�|jtjt�t�|jtjt	�t	�|j
tjtjt���dt
fd��Y}dt
fd��Y}|jdtj|��d�|jttj|��|�}d�|_|jttj|�|jttj|d�dS(Nilg�?s	ceil(0.5)g�?s	ceil(1.0)s	ceil(1.5)g�?is
ceil(-0.5)g�is
ceil(-1.0)g�i����s
ceil(-1.5)g��tTestCeilcBseZd�ZRS(cSsdS(Ngfffff�D@((R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt	__float__s(t__name__t
__module__RV(((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyRUst
TestNoCeilcBseZRS((RWRX(((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyRYssceil(TestCeil())i*cWs|S(N((targs((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt<lambda>!t(R>R?RtceilRIR!ttypeR:RBRCRDRERFtobjectt__ceil__(R7RURYtt((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestCeils*	cCs�|jtjdd�d�|jtjdd�d�|jtjdd�d�|jtjdd�d�|jtjd	d
�d�|jttj�|jtjdd�d�|jtjdd
�d�|jtjtd�t�|jtjtd
�t�|jtjtd�t�|jtjtd
�t�|jtjdt�d�|jtjdt�d�|jtjtt�t�|jtjtt�t�|jtjtt�t�|jtjtt�t�|jtjtjt	d���|jtjtjt	t���|jtjtjt	t���|jtjtjt	t	���|jtj
tjtt	���|jttjdt	��d�dS(
Nii*g�?gi���g�ig@g@g�g�g@(RIRtcopysignR>R?RBRCRDRERFRR
(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestCopysign%s0"""""cCs:|jttj�|jdtjtjd�d�|jdtjd�d�|jdtjtjd�d�|jdtjtj�d�yB|jtjtjt���|jtjtjt	���Wn=t
k
r|jt
tjt�|jt
tjt	�nX|jtjtjt���dS(	Ns
cos(-pi/2)iiscos(0)is	cos(pi/2)scos(pi)i����(R>R?RtcosR:R;RDRERBRCRARF(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestCosGs$##
cCs�|jttj�|jdtjd�d�|jdtjd�dtjd�dd�|jtjt�t�|jtjt�t�|jtj	tjt
���dS(Nscosh(0)iiscosh(2)-2*cosh(1)**2ii����(R>R?RtcoshR:RIRBRCRDRERF(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestCoshUs1cCs}|jttj�|jdtjtj�d�|jdtjtjd�d�|jdtjtjd�d�dS(	Nsdegrees(pi)g�f@s
degrees(pi/2)ig�V@sdegrees(-pi/4)ig�F�(R>R?RtdegreesR:R;(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestDegrees]s#cCs�|jttj�|jdtjd�dtj�|jdtjd�d�|jdtjd�tj�|jtjt�t�|jtjt�d�|j	tj
tjt���dS(Nsexp(-1)i����isexp(0)isexp(1)g(R>R?RR+R:R<RIRBRCRDRERF(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestExpcs#cCsk|jttj�|jdtjd�d�|jdtjd�d�|jdtjd�d�dS(Nsfabs(-1)i����isfabs(0)isfabs(1)(R>R?RtfabsR:(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestFabslsc	Cs�d�}td�dddg}tj|�xh|D]`}xWtttfD]F}|jtj||��||�|||�tj|�f�qLWq6W|j	t
tjd�|j	t
tjtj�dS(NcSs8d}x+tdt|�d�D]}||9}q W|S(Ni(trangetint(Rtresultti((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pytfactss i
i2idi�i����(RntrandomtshuffleRotlongR!RIRt	factorialR>RAR;(R7RrtvaluesR
tcast((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt
testFactorialrs	

HcCsM|jttj�|jtttjd���|jtttjd���|jtttjd���|jdtjd�d�|jdtjd�d�|jdtjd	�d�|jd
tjd�d�|jd
tjd�d�|jdtjd�d�|jdtjd�d�|jdtjd�d�|jtjt	�t	�|jtjt
�t
�|jtjtjt
���dtfd��Y}dtfd��Y}|jdtj|��d�|jttj|��|�}d�|_|jttj|�|jttj|d�dS(Nilg�?s
floor(0.5)g�?is
floor(1.0)s
floor(1.5)g�?sfloor(-0.5)g�i����sfloor(-1.0)g�sfloor(-1.5)g��i����sfloor(1.23e167)g��Nݯ�bsfloor(-1.23e167)g��Nݯ��t	TestFloorcBseZd�ZRS(cSsdS(Ngfffff&E@((R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyRV�s(RWRXRV(((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyRz�stTestNoFloorcBseZRS((RWRX(((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyR{�ssfloor(TestFloor())i*cWs|S(N((RZ((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyR[�R\(R>R?RtfloorRIR!R^R:R]RBRCRDRERFR_t	__floor__(R7RzR{Ra((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt	testFloor�s.	cCsC|jttj�|jdtjdd�d�|jdtjdd�d�|jdtjdd�d�|jd	tjd
d�d�|jdtjd
d�d�|jdtjd
d�d
�|jtjtjtd���|jtjtjdt���|jtjtjtt���|jttjdd�|jttjt	d�|jttjt
d�|jttjt	d�|jtjdt	�d�|jtjdt	�d�|jtjdt
�d�|jtjdt
�d�|jtjdd�d�|jtjdt
�d�dS(Ns
fmod(10,1)i
iisfmod(10,0.5)g�?sfmod(10,1.5)g�?sfmod(-10,1)i����s
fmod(-10,0.5)s
fmod(-10,1.5)i����g�?gg@g�(R>R?RtfmodR:RDRERFRARBRCRI(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestFmod�s("""cs��jttj��fd�}|dtjd�d�|dtjd�d
�|dtjd�d�|d
tjd�d��jtjt�dt��jtjt�dt��jtjtjt	�d��dS(Ncsh||\}}\}}t||�tks;||krd�jd|||f||ff�ndS(Ns%s returned %r, expected %r(R
R5R6(R8RpRtmantR+temantteexp(R7(s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt	testfrexp�s"	s	frexp(-1)i����g�isfrexp(0)isfrexp(1)g�?sfrexp(2)i(g�i(ii(g�?i(g�?i(
R>R?RtfrexpRIRBRCRDRERF(R7R�((R7s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt	testFrexp�ss2fsum is not exact on machines with double roundingcsRddlm}|j�|j����fd�}gdfdgdfddddd	d
dgdfd1dd3gd5fd6dd7gd9fd;dd<gd>fd@ddAgdCfgtdd�D]}d|^q�tjd�fgtdd�D]}d
||^q�tjd�fgtd�D]}d|dd|^q(dEgd
fdddgdfdFddGdIddJgdfgtd d!d"�D](}d|d|d#d|d$^q�dLgtjd&�fg
}x�t|�D]�\}\}}ytj	|�}WnUt
k
r=|jd'|||f�n+tk
rg|jd(|||f�nX|j
||�q�Wdd)lm}	m}
m}x�td�D]�}d*dd+dd,d-gd.}d/}
xEtd0�D]7}|
d/|	��d*|
}|
|7}
|j|�q�W||�||�}
|j
||�tj	|��q�WdS(MNi����(t
float_infocs"d\}}x�|D]y}tj|�\}}ttj|���|�}}||krt|||K}|}n|||K}||7}qWtttt|���d��|�}|dkrd|d>}|d|t||@o�|d|d@�}||7}ntj||�S(s�Full precision summation.  Compute sum(iterable) without any
            intermediate accumulation of error.  Based on the 'lsum' function
            at http://code.activestate.com/recipes/393090/

            iiii(ii(	RR�RotldexpRtlentbinR
tbool(titerablettmantttexpR
R�R+ttailth(tetinytmant_dig(s5/usr/local/python-2.7/lib/python2.7/test/test_math.pytmsum�s
#	-.
gg}Ô%�I�Tg�?g}Ô%�I��g0��.�++g�d~�QJg�g�d~�Q�g@i5g�i���i����g$@g(@g@g�?g@ii�s0x1.df11f45f4e61ap+2s-0x1.62a2af1bd3624p-1i�g333333�?g��7y�ACg��ؗ�Ҝ<g��7y�ACi���i���i�ii2i4i�s0x1.5555555555555p+970sDtest %d failed: got OverflowError, expected %r for math.fsum(%.100r)sAtest %d failed: got ValueError, expected %r for math.fsum(%.100r)(RstgaussRtii����gh�$.5���g#B����;i
ii�g@Cg�<g��g@Cg������?Cg@Cg�9g@Cg@Cg@Cg@Cg�9g@Cg@Cg@Cg������?Cg�<g@Cg������?Cg����-�og����-��g��7y�ACg�<g��7y�ACg��7y�A�g�<g�g�(tsysR�R�tmin_expRnR!tfromhext	enumerateRtfsumt
OverflowErrorR6RARIRsR�Rttxrangetappend(R7R�R�RRqttest_valuestvalsRtactualRsR�Rttjtstv((R�R�s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestFsum�sT	
	#'9>
	
	

cCs	|jttj�|jdtjdd�d�|jdtjdd�d�|jtjtt�t�|jtjtt�t�|jtjtt�t�|jtjtt�t�|j	tj
tjdt���|j	tj
tjtd���dS(	Ns
hypot(0,0)is
hypot(3,4)iiig�?g�(R>R?RthypotR:RIRFRBRCRDRE(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt	testHypot$s"cCs|jttj�|jdtjdd�d�|jdtjdd�d�|jdtjdd�d�|jd	tjdd�d
�|jttjdd�|jttjd
d�|jtjdd�d�|jtjd
d�d�|jtjtd�t�|jtjtd�t�|j	tj
tjtd���x�ddddddgD]�}|jtjt|�t�|jtjt|�t�|jtjd|�d�|jtjd
|�d�|jtjd|�d�|jtjd|�d�|j	tj
tjt|���|jttjd|�|jttjd
|�|jtjd|�d�|jtjd|�d�|jtjt|�t�|jtjt|�t�|j	tj
tjt|���qlWdS(Ns
ldexp(0,1)iis
ldexp(1,1)isldexp(1,-1)i����g�?sldexp(-1,1)i����g�?i@Bg�i���gg�ii+���i
il
ii(i��l�I�Tld(	l F�x:^Vl	�O�z��p�c(R>R?RR�R:R�RIRBRCRDRERF(R7R((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt	testLdexp/s6"#cCsb|jttj�|jdtjdtj�d�|jdtjd�d�|jdtjtj�d�|jdtjdd	�d
�|jdtjdd�d
�|jdtjdd�d	�|jtjt�t�|jttjt	�|j
tjtjt���x?t
dd�D].}|jtj|�tjt|���q,WdS(Nslog(1/e)ii����slog(1)islog(e)s	log(32,2)i iislog(10**40, 10)i
i(slog(10**40, 10**20)ii�l	�O�z��p�cl	�O�z��p�cl F�x:^V(R>R?RtlogR:R<RIRBRARCRDRERFRnRu(R7R((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestLogOs#cCs7|jttj�|jdtjdtjd�d�|jdtjd�d�|jdtjtjd�d�|jdtjd�tjd��|jtjt�t�|jt	tjt
�|jtjtjt
���d}|jtj|�d
�|jtj|�tjt|���dS(Ns
log1p(1/e -1)ii����slog1p(0)is
log1p(e-1)slog1p(1)iiZgx�61O@l(R>R?Rtlog1pR:R<R�RIRBRARCRDRERFtassertAlmostEqualR!(R7R((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt	testLog1p^s'#%cCs�|jttj�|jdtjd�d�|jdtjd�d�|jdtjd�d�|jtjt�t�|jttjt	�|j
tjtjt���x?t
dd	�D].}|jtj|�tjt|���q�WdS(
Ns
log10(0.1)g�������?i����slog10(1)iis	log10(10)i
i�(R>R?Rtlog10R:RIR�RBRARCRDRERFRnRu(R7R((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt	testLog10kscs��jttj��fd�}|dtjd�d�|dtjd�d��jtjt�d
tf��jtjt�dtf�tjt�}�jtj	|d���jtj	|d
��dS(Ncsl||\}}\}}t||�tks?t||�rh�jd|||f||ff�ndS(Ns%s returned %r, expected %r(R
R5R6(R8RpRtv1tv2te1te2(R7(s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestmodfzs&	s	modf(1.5)g�?g�?g�?s
modf(-1.5)g��g�g�gg�ii(g�?g�?(g�g�(
R>R?RtmodfRIRBRCRFRDRE(R7R�tmodf_nan((R7s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestModfwscCs�|jttj�|jdtjdd�d�|jdtjdd�d�|jdtjdd�d�|jdtjdd�d	�|jtjtd�t�|jtjtd�t�|jtjdt�d
�|jtjdt�d
�|jtj	tjt
d���|jtj	tjdt
���|jtj	tjdt
���|jtjdt
�d�|jtjdt�d�|jtjdd�d�|jtjdd
�d�|jtjdd�d�|jtjdd�d
�|jtjdd�d
�|jttjdd�|jttjdd�|jttjdd�|jttjdt�|jtj	tjdt
���|jtjtt�t�|jtjtd�t�|jtjtd
�t�|jtjtd�t�|jtjtd�d
�|jtjtd�d
�|jtjtd�d�|jtjtd�d�|jtjtd�d�|jtjtt�d�|jtj	tjtt
���|jtjdt�d�|jtjdd�d�|jtjdd
�d�|jtjdd�d�|jtjdd�d
�|jtjdd�d
�|jttjdd�|jttjdd�|jttjdd�|jttjdt�|jtj	tjdt
���|jtjtt�t�|jtjtd�t�|jtjtd
�t�|jtjtd�t�|jtjtd�d
�|jtjtd�d
�|jtjtd�d�|jtjtd�d�|jtjtd�d�|jtjtt�d�|jtj	tjtt
���|jtjdt�d
�|jtjdd�d�|jttjdd
�|jtjdd�d
�|jtjdd�d
�|jtjdd�d
�|jtjdd�d
�|jttjdd�|jtjdd�d�|jtjdt�d
�|jtj	tjdt
���|jtjd
t�d
�|jtjd
d�d
�|jtjd
d
�d
�|jtjd
d�d
�|jtjd
d�d
�|jtjd
d�d
�|jtjd
d�d
�|jtjd
d�d
�|jtjd
d�d
�|jtjd
t�d
�|jtjd
t
�d
�|jtjd
d�d
�|jtjdd�d
�|jtjt
d�d
�|jtjd
d�d
�|jtjdd�d
�|jtjt
d�d
�|jttjdd
�|jttjdd�|jtjdt�d�|jtjdt�d�|jtjdt�t�|jtjdt�t�|jtjdt�t�|jtjdt�t�|jtjdt�d�|jtjdt�d�|jtjdt�t�|jtjdt�t�|jtjdt�d�|jtjdt�d�|jtjdt�d�|jtjdt�d�|jtjdt�t�|jtjdt�t�|jdtjdd�d�|jd tjdd�d!�|jd"tjdd
�d�|jd#tjdd�d
�|jd$tjdd�d
�|jd%tjdd�d&�|jd'tjdd�d(�|jd)tjdd�d*�|jttjdd&�|jttjdd	�dS(+Nspow(0,1)iispow(1,0)spow(2,1)is	pow(2,-1)i����g�?g�?gg@gffffff@g@g�g�gffffff�g�g�g.�g�������gffffff�?g�������?g�������?g�������?g��������g�������g�������gffffff��s	(-2.)**3.g �s	(-2.)**2.g@s	(-2.)**1.s	(-2.)**0.s
(-2.)**-0.s
(-2.)**-1.g�s
(-2.)**-2.g�?s
(-2.)**-3.g��(R>R?RtpowR:RIRBRCRDRERFRA(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestPow�s�""""""""cCs}|jttj�|jdtjd�tj�|jdtjd�tjd�|jdtjd�tjd�dS(	Nsradians(180)i�sradians(90)iZisradians(-45)i���i(R>R?RtradiansR:R;(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestRadianss#cCs|jttj�|jdtjd�d�|jdtjtjd�d�|jdtjtjd�d�yB|jtjtjt���|jtjtjt	���Wn=t
k
r�|jt
tjt�|jt
tjt	�nX|jtjtjt���dS(Nssin(0)is	sin(pi/2)iis
sin(-pi/2)i����(R>R?RtsinR:R;RDRERBRCRARF(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestSin%s#$#
cCs�|jttj�|jdtjd�d�|jdtjd�dtjd�dd�|jdtjd�tjd�d�|jtjt�t�|jtjt�t�|j	tj
tjt���dS(Nssinh(0)issinh(1)**2-cosh(1)**2iii����ssinh(1)+sinh(-1)(R>R?RtsinhR:RgRIRBRCRDRERF(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestSinh2s1)cCs�|jttj�|jdtjd�d�|jdtjd�d�|jdtjd�d�|jtjt�t�|jttjt�|j	tj
tjt���dS(Nssqrt(0)issqrt(1)issqrt(4)ii(R>R?RtsqrtR:RIRBRARCRDRERF(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestSqrt;scCs|jttj�|jdtjd�d�|jdtjtjd�d�|jdtjtjd�d�yB|jtjtjt���|jtjtjt	���Wn3|jt
tjt�|jt
tjt	�nX|jtjtjt���dS(Nstan(0)is	tan(pi/4)iis
tan(-pi/4)i����(R>R?RttanR:R;RDRERBRCRARF(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestTanDs#$#cCs|jttj�|jdtjd�d�|jdtjd�tjd�d�|jdtjt�d�|jdtjt�d�|jtjtjt	���t
jd�jd	�r|j
tjd
�d
�|j
tjdtjd
��tjdd
��ndS(Nstanh(0)istanh(1)+tanh(-1)ii����s	tanh(inf)s
tanh(-inf)RRg�g�?(R>R?RttanhR:RBRCRDRERFR!t
__getformat__R.RIRc(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttestTanhQs)cCs�|jtjd�d�|jtjd�d�|jttjd��t�|jttjd��t�|jtjd�d�|jtjd�d�|jtjd�d�|jtjd�d�|jtjd�d�|jtjd	�d
�dtfd��Y}d
tfd��Y}|jtj|��d�|jttj�|jttjdd�|jttftj|��dS(Nii����g�?g��g����?g�����g�!��ig-���?Y�i����t	TestTrunccBseZd�ZRS(cSsdS(Ni((R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt	__trunc__ks(RWRXR�(((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyR�jstTestNoTrunccBseZRS((RWRX(((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyR�nsii(	RIRttruncR^RoR_R>R?tAttributeError(R7R�R�((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt
test_trunc^s"cCs�|jtjtd���|jtjtd�d��|jtjtd���|jtjd��|jtjd��dS(NRRgg�?(RDRRER!tassertFalse(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt	testIsnanxs
 cCs�|jtjtd���|jtjtd���|jtjd��|jtjd��|jtjtd���|jtjd��|jtjd��dS(NRs-infg�g�Rgg�?(RDRRR!R�(R7((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt	testIsinfssrequires verbose modecCs�ytjd�}Wn|jd�nX|dkrF|jd�nytjd�}Wntk
rlnX|jd�ytjd�}Wntk
r�nX|jd�dS(	Ni6e�s6underflowing exp() should not have raised an exceptionis)underflowing exp() should have returned 0iʚ;s.overflowing exp() didn't trigger OverflowErrorg�s sqrt(-1) didn't raise ValueError(RR+R6R�R�RA(R7R
((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttest_exceptions�s 


cCsx
tt�D]�\}}}}}}}|dks
|dks
|rLq
n|dkr^q
ntt|�}y||�}	Wnitk
r�dd|||f}
|j|
�n5tk
r�dd|||f}
|j|
�nX|jd|||f|	|�q
WdS(	NgtrecttpolarsUnexpected ValueError in stest %s:%s(%r)
sUnexpected OverflowError in s	%s:%s(%r)(R�R�(R3t	test_filetgetattrRRAR6R�R:(R7R'R(tartaiterteiR,tfuncRptmessage((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt
test_testfile�s"(

RRstest requires IEEE 754 doublesc
Cs>d}d}g}xtt�D]�\}}}}}tt|�}	d|ks[d|krdd}nd|kryd}ny|	|�}
Wn-tk
r�d}
ntk
r�d}
nXd}t|
t�r�t|t�r�tj	|�rtj	|
�rqntj	|�r�tj	|
�r�|dkrKt
||
d	d
dd
�}n3|dkrlt||
d
�}nt||
d�}|dkr�qq�q�nt|
t�r�t|t�r�|
|kr�qq�n|j
|||||
�}|dk	r|dj
|�7}n|j|�qW|r:|jddj|��ndS(Nis${}:{}({!r}): expected {!r}, got {!r}tinvalidsdivide-by-zeroRAtoverflowR�tlgammaRg�+�����<Rterfci�s ({})sFailures in test_mtestfile:
  s
  (R-tmath_testcasesR�RRAR�Rt
isinstanceR!RERRtstrRR�R6tjoin(
R7t
ALLOWED_ERRORtfail_fmttfailuresR'R(R)RR,R�Rtaccuracy_failuretfail_msg((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyttest_mtestfile�sN"		
	

 		(3RWRXR:R=RGRJRLRNRPRRRTRbtrequires_IEEE_754RdRfRhRjRkRmRyR~R�R�tunittesttskipIftHAVE_DOUBLE_ROUNDINGR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�t
skipUnlessRR�R�R!R�R.R�(((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyR4�sV						
								=	"								!			Y		 		
			�		
					
	
			 cCsSddlm}tj�}|jtjt��|j|d��t|�dS(Ni����(tDocFileSuitesieee754.txt(tdoctestR�R�t	TestSuitetaddTestt	makeSuiteR4R(R�tsuite((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt	test_mains
((ttest.test_supportRRR�RtosR�RsRR5R!RFRBRCR�R�R.R�R
tyR�RWtargvtfilet__file__tpathtdirnametcurdirttest_dirR�R�R�RRRR-R3tTestCaseR4R�(((s5/usr/local/python-2.7/lib/python2.7/test/test_math.pyt<module>sB				����	
© 2025 GrazzMean