Your IP : 216.73.216.213


Current Path : /opt/alt/python33/lib64/python3.3/test/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/test/__pycache__/test_math.cpython-33.pyo

�
��f��c@s�ddlmZmZmZddlmZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZdZ
ed�Zed�Zed�Zdd	f\ZZeedd
kZedkr�e
jdZneZejje�p
ejZejjed�Zejjed
�Zdd�Z ddd�Z!dd�Z"dd�Z#dd�Z$dddd�Z%dd�Z&dd �Z'Gd!d"�d"ej(�Z)d#d$�Z*edkr�e*�ndS(%i(urun_unittestuverboseurequires_IEEE_754(usupportNg�h㈵��>unanuinfu-infg��7y�ACg�):��@iu__main__umath_testcases.txtucmath_testcases.txtcCs@tjdtjd|��d}|dkr<|d}n|S(uVConvert 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.

    u<qu<diii?l(ustructuunpackupack(uxun((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyuto_ulps!s
"uto_ulpsicCs<t|�t|�}t|�|kr,dSdj||�S(u�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.u*error = {} ulps; permitted error = {} ulpsN(uto_ulpsuabsuNoneuformat(uexpectedugotuulpsu
ulps_error((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu
ulps_check0s
	u
ulps_checkcCs |rdt||d@�SdS(uANumber of '1' bits in binary expansion of a nonnnegative integer.ii(ucount_set_bits(un((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyucount_set_bitsQsucount_set_bitscCsT||d?}|sdS|dkr(|S||dB}t||�t||�SdS(u�Product of integers in range(start, stop, 2), computed recursively.
    start and stop should both be odd, with start <= stop.

    iN(upartial_product(ustartustopu
numfactorsumid((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyupartial_productUsupartial_productcCsxd}}xYtt|j���D]?}|t||d?ddB||?ddB�9}||9}q#W||t|�>S(u�Factorial of nonnegative integer n, via "Binary Split Factorial Formula"
    described at http://www.luschny.de/math/factorial/binarysplitfact.html

    i(ureversedurangeu
bit_lengthupartial_productucount_set_bits(unuinneruouterui((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyupy_factorialcs

/upy_factorialgV瞯�<g
cCshtj|�r||krdS||}t||t|��}t|�|krXdSdj||�S(uDetermine 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.u error = {}; permitted error = {}N(umathuisinfuNoneumaxuabsuformat(uexpectedugoturel_erruabs_erruerrorupermitted_error((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	acc_checkns
	u	acc_checkc
cs�t|���}x�|D]�}d|krD|d|jd��}n|j�sVqn|jd�\}}|j�\}}}|j�}|d}	|dd�}
||t|�t|	�|
fVqWWdQXdS(u�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]*

    u--Nu->ii(uopenuindexustripusplitufloat(ufnameufpulineulhsurhsuidufnuargu
rhs_piecesuexpuflags((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyuparse_mtestfile�s	

uparse_mtestfilec
cs�t|���}x�|D]�}|jd�s|j�r>qn|jd�\}}|j�\}}}}|j�}	|	d|	d}
}|	dd�}||t|�t|�t|
�t|�|fVqWWdQXdS(u�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
    u--u->iiiN(uopenu
startswithustripusplitufloat(
ufnameufpulineulhsurhsuidufnuarg_realuarg_imagu
rhs_piecesuexp_realuexp_imaguflags((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyuparse_testfile�s
uparse_testfilecBs�|EeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Ze
dd��Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Ze
ejed)�d*d+���Zd,d-�Zd.d/�Zd0d1�Zd2d3�Ze
d4d5��Z e
e!j"d6d7�d8d9���Z#d:d;�Z$d<d=�Z%d>d?�Z&d@dA�Z'dBdC�Z(dDdE�Z)dFdG�Z*dHdI�Z+dJdK�Z,e
eje-j.dL�dMkdN�dOdP���Z/dQdR�Z0dSdT�Z1dUdV�Z2dWdX�Z3ej4e5dY�dZd[��Z6e
d\d]��Z7e
d^d_��Z8d`S(au	MathTestscCs7t||�tkr3|jd|||f�ndS(Nu%s returned %r, expected %r(uabsuepsufail(uselfunameuvalueuexpected((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyuftest�s	uMathTests.ftestcCs0|jdtjd�|jdtjd�dS(NupigJ�M�!	@uegB�
�@(uftestumathupiue(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu
testConstants�suMathTests.testConstantscCs�|jttj�|jdtjd�tj�|jdtjd�tjd�|jdtjd�d�|jttjt�|jttjt�|j	tj
tjt���dS(Nuacos(-1)iuacos(0)iiuacos(1)i����(uassertRaisesu	TypeErrorumathuacosuftestupiu
ValueErroruINFuNINFu
assertTrueuisnanuNAN(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestAcos�s#uMathTests.testAcoscCs�|jttj�|jdtjd�d�|jdtjd�d�|jttjd�|jttjd�|jtjt�t�|jttjt�|j	tj
tjt���dS(Nuacosh(1)iiuacosh(2)ig5�qB�?i����(uassertRaisesu	TypeErrorumathuacoshuftestu
ValueErroruassertEqualuINFuNINFu
assertTrueuisnanuNAN(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	testAcosh�suMathTests.testAcoshcCs�|jttj�|jdtjd�tjd�|jdtjd�d�|jdtjd�tjd�|jttjt�|jttjt�|j	tj
tjt���dS(Nuasin(-1)iiuasin(0)iuasin(1)i����(uassertRaisesu	TypeErrorumathuasinuftestupiu
ValueErroruINFuNINFu
assertTrueuisnanuNAN(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestAsin�s$#uMathTests.testAsincCs�|jttj�|jdtjd�d�|jdtjd�d�|jdtjd�d�|jtjt�t�|jtjt�t�|jtj	tjt
���dS(	Nuasinh(0)iuasinh(1)ig'�ya64�?u	asinh(-1)i����g'�ya64�(uassertRaisesu	TypeErrorumathuasinhuftestuassertEqualuINFuNINFu
assertTrueuisnanuNAN(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	testAsinh�suMathTests.testAsinhcCs�|jttj�|jdtjd
�tjd�|jdtjd�d�|jdtjd�tjd�|jdtjt�tjd�|jd	tjt�tjd�|jtj	tjt
���dS(Nuatan(-1)iiuatan(0)iuatan(1)u	atan(inf)iu
atan(-inf)i����(uassertRaisesu	TypeErrorumathuatanuftestupiuINFuNINFu
assertTrueuisnanuNAN(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestAtan�s$##$uMathTests.testAtancCs�|jttj�|jdtjd�d�|jdtjd�d�|jdtjd�d	�|jttjd�|jttjd
�|jttjt�|jttjt�|j	tj
tjt���dS(Nuatanh(0)iu
atanh(0.5)g�?g�z��?uatanh(-0.5)ig�g�z��i����(uassertRaisesu	TypeErrorumathuatanuftestuatanhu
ValueErroruINFuNINFu
assertTrueuisnanuNAN(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	testAtanh�suMathTests.testAtanhcCs�|jttj�|jdtjd%d�tjd�|jdtjd&d�tjd�|jdtjdd�d�|jdtjdd�tjd�|jd	tjdd�tjd�|jd
tjdt�tj�|jdtjdd'�tj�|jdtjdd(�tj�|jtjdd�d�|jtjdd
�d�|jtjdt�d�|j	tj
tjdt���|jdtjd)t�tj�|jdtjd*d+�tj�|jdtjd,d-�tj�|jtjd.d�d/�|jtjd0d
�d1�|jtjd2t�d3�|j	tj
tjd4t���|jdtjtt�tjdd�|jdtjtd5�tjd�|jdtjtd6�tjd�|jdtjtd�tjd�|jdtjtd
�tjd�|jdtjtt�tjd�|j	tj
tjtt���|jdtjtt�tjdd�|jdtjtd7�tjd�|jdtjtd8�tjd�|jdtjtd�tjd�|jdtjtd
�tjd�|jdtjtt�tjd�|j	tj
tjtt���|jdtjd
t�tj�|jd tjd
d9�tjd�|jd!tjd
d�tjd�|jtjd
t�d�|j	tj
tjd
t���|jd"tjd:t�tj�|jd#tjd;d<�tjd�|jd$tjd=d�tjd�|jtjd>t�d?�|j	tj
tjd@t���|j	tj
tjtt���|j	tj
tjtdA���|j	tj
tjtdB���|j	tj
tjtd���|j	tj
tjtd
���|j	tj
tjtt���|j	tj
tjtt���dS(CNuatan2(-1, 0)iiiuatan2(-1, 1)iuatan2(0, 1)uatan2(1, 1)uatan2(1, 0)uatan2(0., -inf)guatan2(0., -2.3)gffffff@uatan2(0., -0.)uatan2(-0., -inf)uatan2(-0., -2.3)uatan2(-0., -0.)uatan2(inf, -inf)iuatan2(inf, -2.3)uatan2(inf, -0.)uatan2(inf, 0.)uatan2(inf, 2.3)uatan2(inf, inf)uatan2(-inf, -inf)uatan2(-inf, -2.3)uatan2(-inf, -0.)uatan2(-inf, 0.)uatan2(-inf, 2.3)uatan2(-inf, inf)uatan2(2.3, -inf)uatan2(2.3, -0.)uatan2(2.3, 0.)uatan2(-2.3, -inf)uatan2(-2.3, -0.)uatan2(-2.3, 0.)i����i����gffffff�g�g�g�gffffff�g�g�g�g�g�g�g�g�g�gffffff�g�gffffff�g�g�gffffff�gffffff�g�gffffff�gffffff�g�gffffff�gffffff�g�(uassertRaisesu	TypeErrorumathuatan2uftestupiuNINFuassertEqualuINFu
assertTrueuisnanuNAN(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	testAtan2�sf''&&""""###"*&&&&&"+'''''""&&"#''"""""""uMathTests.testAtan2cCs�|jttj�|jtttjd���|jdtjd�d�|jdtjd�d�|jdtjd�d�|jd	tjd�d
�|jdtjd�d�|jdtjd�d�Gd
d�d�}Gdd�d�}|jdtj|��d�|jttj|��|�}dd�|_|jttj|�|jttj|d
�dS(Ng�?u	ceil(0.5)iu	ceil(1.0)g�?u	ceil(1.5)g�?iu
ceil(-0.5)iu
ceil(-1.0)u
ceil(-1.5)cBs |EeZdZdd�ZdS(u$MathTests.testCeil.<locals>.TestCeilcSsdS(Ni*((uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu__ceil__Esu-MathTests.testCeil.<locals>.TestCeil.__ceil__N(u__name__u
__module__u__qualname__u__ceil__(u
__locals__((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyuTestCeilDsuTestCeilcBs|EeZdZdS(u&MathTests.testCeil.<locals>.TestNoCeilN(u__name__u
__module__u__qualname__(u
__locals__((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu
TestNoCeilGsu
TestNoCeiluceil(TestCeil())i*cWs|S(N((uargs((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu<lambda>Msu$MathTests.testCeil.<locals>.<lambda>g�g�i����g��i����(	uassertRaisesu	TypeErrorumathuceiluassertEqualuintutypeuftestu__ceil__(uselfuTestCeilu
TestNoCeilut((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestCeil7s 	uMathTests.testCeilcCs�|jtjdd�d�|jtjdd�d�|jtjdd	�d
�|jtjdd�d�|jtjdd�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	���|jttjdt	��d�dS(Nii*g�?gig@g@g@i���g�g�g�g�g�g�g�g�(uassertEqualumathucopysignuassertRaisesu	TypeErroruINFuNINFu
assertTrueuisnanuNANuisinfuabs(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestCopysignQs0"""""uMathTests.testCopysigncCs;|jttj�|jdtjtjd�d�|jdtjd�d�|jdtjtjd�d�|jdtjtj�d�yB|jtjtjt���|jtjtjt	���Wn>t
k
r|jt
tjt�|jt
tjt	�YnX|jtjtjt���dS(	Nu
cos(-pi/2)iiucos(0)iu	cos(pi/2)ucos(pi)i����(uassertRaisesu	TypeErrorumathucosuftestupiu
assertTrueuisnanuINFuNINFu
ValueErroruNAN(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestCosss$##
uMathTests.testCoscCs�|jttj�|jdtjd�d�|jdtjd�dtjd�dd�|jtjt�t�|jtjt�t�|jtj	tjt
���dS(Nucosh(0)iiucosh(2)-2*cosh(1)**2ii����(uassertRaisesu	TypeErrorumathucoshuftestuassertEqualuINFuNINFu
assertTrueuisnanuNAN(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestCosh�s1uMathTests.testCoshcCs}|jttj�|jdtjtj�d�|jdtjtjd�d�|jdtjtjd�d	�dS(
Nudegrees(pi)g�f@u
degrees(pi/2)ig�V@udegrees(-pi/4)ig�F@g�F�(uassertRaisesu	TypeErrorumathudegreesuftestupi(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestDegrees�s#uMathTests.testDegreescCs�|jttj�|jdtjd�dtj�|jdtjd�d�|jdtjd�tj�|jtjt�t�|jtjt�d�|j	tj
tjt���dS(Nuexp(-1)iuexp(0)iuexp(1)gi����(uassertRaisesu	TypeErrorumathuexpuftestueuassertEqualuINFuNINFu
assertTrueuisnanuNAN(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestExp�s#uMathTests.testExpcCsk|jttj�|jdtjd�d�|jdtjd�d�|jdtjd�d�dS(Nufabs(-1)iufabs(0)iufabs(1)i����(uassertRaisesu	TypeErrorumathufabsuftest(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestFabs�suMathTests.testFabscCs/|jtjd�d�|jtjd�d�d}xxtdd�D]g}||9}|jtj|�|�|jtjt|��|�|jtj|�t|��qHW|jttjd�|jttjd�|jttjtj�|jt	tjt
jd�|jt	tjd�dS(	Niigi�g�?g\�n��Ti����g�(uassertEqualumathu	factorialurangeufloatupy_factorialuassertRaisesu
ValueErrorupiu
OverflowErrorusysumaxsize(uselfutotalui((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu
testFactorial�s
#uMathTests.testFactorialcCs�|jttj�|jtttjd���|jdtjd�d�|jdtjd�d�|jdtjd�d�|jd	tjd�d�|jd
tjd�d�|jdtjd�d�|jd
tjd�d�|jdtjd�d�Gdd�d�}Gdd�d�}|jdtj|��d�|jttj|��|�}dd�|_|jttj|�|jttj|d�dS( Ng�?u
floor(0.5)iu
floor(1.0)g�?iu
floor(1.5)g�?ufloor(-0.5)ufloor(-1.0)ufloor(-1.5)iufloor(1.23e167)g��Nݯ�bufloor(-1.23e167)cBs |EeZdZdd�ZdS(u&MathTests.testFloor.<locals>.TestFloorcSsdS(Ni*((uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	__floor__�su0MathTests.testFloor.<locals>.TestFloor.__floor__N(u__name__u
__module__u__qualname__u	__floor__(u
__locals__((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	TestFloor�su	TestFloorcBs|EeZdZdS(u(MathTests.testFloor.<locals>.TestNoFloorN(u__name__u
__module__u__qualname__(u
__locals__((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyuTestNoFloor�suTestNoFloorufloor(TestFloor())i*cWs|S(N((uargs((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu<lambda>�su%MathTests.testFloor.<locals>.<lambda>g�i����g�i����g��i����g��Nݯ��g��Nݯ��(	uassertRaisesu	TypeErrorumathuflooruassertEqualuintutypeuftestu	__floor__(uselfu	TestFlooruTestNoFloorut((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	testFloor�s$	uMathTests.testFloorcCsC|jttj�|jdtjdd�d�|jdtjdd�d�|jdtjdd�d	�|jd
tjdd�d�|jdtjdd�d�|jdtjdd�d�|jtjtjtd	���|jtjtjd	t���|jtjtjtt���|jttjd	d�|jttjt	d	�|jttjt
d	�|jttjt	d�|jtjd
t	�d
�|jtjdt	�d�|jtjd
t
�d
�|jtjdt
�d�|jtjdd
�d�|jtjdt
�d�dS(Nufmod(10, 1)i
igu
fmod(10, 0.5)g�?u
fmod(10, 1.5)g�?g�?ufmod(-10, 1)ufmod(-10, 0.5)ufmod(-10, 1.5)g@i����g�i����g�i����g�g�g�g�g�(uassertRaisesu	TypeErrorumathufmoduftestu
assertTrueuisnanuNANu
ValueErroruINFuNINFuassertEqual(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestFmod�s("""uMathTests.testFmodcs��jttj��fdd�}|dtjd�d
�|dtjd�d�|dtjd�d�|d	tjd
�d��jtjt�dt��jtjt�dt��jtjtjt	�d��dS(Ncs\||\}}\}}t||�tks;||krX�jd|||f�ndS(Nu%s returned %r, expected %r(uabsuepsufail(unameuresultuexpectedumantuexpuemantueexp(uself(u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	testfrexp�s"	u&MathTests.testFrexp.<locals>.testfrexpu	frexp(-1)ig�?ufrexp(0)iufrexp(1)ufrexp(2)ii����g�(g�i(ii(g�?i(g�?i(
uassertRaisesu	TypeErrorumathufrexpuassertEqualuINFuNINFu
assertTrueuisnanuNAN(uselfu	testfrexp((uselfu3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	testFrexp�suMathTests.testFrexpu2fsum is not exact on machines with double roundingcs�ddlm}|j�|j����fdd�}gdfdgdfddd.dd	d/d0gdfd1d2d5gd7fd8dd:gd<fd>dd@gdBfdDddFgdHfdd�tdd�D�tjd�fdd�tdd�D�tjd�fdd�td�D�dJgdKfdddgdfdLdOdQdUgdfd d�tdVd"d#�D�dXgtjd%�fg
}x�t|�D]�\}\}}ytj	|�}WnWt
k
r�|jd&|||f�Yn,tk
r|jd'|||f�YnX|j
||�q�Wdd(lm}m}	m}
x�td�D]�}d)ddYdZd[d+gd,}d}xEtd-�D]7}|	d|��d)|}
||
7}|j|
�q�W|
|�||�}|j
||�tj	|��qQWdS(\Ni(u
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(u�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(	umathufrexpuintuldexpumaxulenubinuabsubool(uiterableutmantutexpuxumantuexputailuh(uetinyumant_dig(u3/opt/alt/python33/lib64/python3.3/test/test_math.pyumsums
#	-.
u MathTests.testFsum.<locals>.msumgg}Ô%�I�Tg�?g0��.�++g�d~�QJg@i5g�?i6idg$@g(@g@g@cSsg|]}d|�qS(g�?((u.0un((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu
<listcomp>)s	u&MathTests.testFsum.<locals>.<listcomp>ii�u0x1.df11f45f4e61ap+2cSsg|]}d||�qS(g�?g�((u.0un((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu
<listcomp>+s	u-0x1.62a2af1bd3624p-1cSs&g|]}d|dd|�qS(g333333�?i((u.0ui((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu
<listcomp>-s	i�g333333�?g��7y�ACg��ؗ�Ҝ<g��7y�ACcSs2g|](}d|d|dd|d�qS(g@i2i4((u.0un((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu
<listcomp>1s	i2i�ii�u0x1.5555555555555p+970uDtest %d failed: got OverflowError, expected %r for math.fsum(%.100r)uAtest %d failed: got ValueError, expected %r for math.fsum(%.100r)(urandomugaussushuffleigh�$.5��;g#B����;i
i�g}Ô%�I��g�g�d~�Q�g@Cg�i���g�<g��g@Cg������?Cg@Ci����g�9g@Cg@Cg@Cg@Ci����g�9g@Cg@Cg@Cg������?Ci���g�<g@Cg������?Cg����-�og����-��g�g��7y�ACi���g�<g�������?g��7y�ACg��7y�A�i���g�<g�������?g�������i���g�g�i����g}Ô%�I��gh�$.5���(usysu
float_infoumant_digumin_expurangeufloatufromhexu	enumerateumathufsumu
OverflowErrorufailu
ValueErroruassertEqualurandomugaussushuffleuappend(uselfu
float_infoumsumutest_valuesuiuvalsuexpecteduactualurandomugaussushuffleujusuv((uetinyumant_digu3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestFsum�sT	
	#
	
	

uMathTests.testFsumcCs	|jttj�|jdtjdd�d�|jdtjdd�d�|jtjtt�t�|jtjtt�t�|jtjtt�t�|jtjtt�t�|j	tj
tjdt���|j	tj
tjtd	���dS(
Nu
hypot(0,0)iu
hypot(3,4)iiig�?g@g�(uassertRaisesu	TypeErrorumathuhypotuftestuassertEqualuNANuINFuNINFu
assertTrueuisnan(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	testHypotNs"uMathTests.testHypotcCs	|jttj�|jdtjdd�d�|jdtjdd�d�|jdtjdd�d�|jdtjdd�d�|jttjd	d
�|jttjdd
�|jtjd	d�d�|jtjdd�d�|jtjtd�t�|jtjtd�t�|j	tj
tjtd���x�ddddgD]�}|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|���qfWdS(&Nu
ldexp(0,1)iiu
ldexp(1,1)iuldexp(1,-1)g�?uldexp(-1,1)g�?i@Bgii�i
iii(i����i����i����g�i���g�i���g�i+���i��ld(	l F�x:^Vl	�O�z��p�cg�g�g�g�g�g�g�(uassertRaisesu	TypeErrorumathuldexpuftestu
OverflowErroruassertEqualuINFuNINFu
assertTrueuisnanuNAN(uselfun((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	testLdexpYs6"#uMathTests.testLdexpcCsh|jttj�|jdtjdtj�d�|jdtjd�d�|jdtjtj�d�|jdtjdd�d	�|jd
tjdd�d�|jd
tjdd�d�|jdtjd�d�|jttjd�|jttjd�|jttjt�|jtjt	�t	�|j
tjtjt���dS(Nulog(1/e)iulog(1)iulog(e)u	log(32,2)i iiulog(10**40, 10)i
i(ulog(10**40, 10**20)iu
log(10**1000)i�gO�+��@g�?i����l	�O�z��p�cl	�O�z��p�cl F�x:^Vl�3qvN�h�iKa��K�P�"�q����!��a�0mvK0<tI	D�[��7�fj�wld:,"�P�S�^
g�2�$�({P_R�U��vD9�{�)P�Anf�YD8�5PgH�#�q�EgS�d27�}��W>�Y��y�{A\<	�z�kZ� �p�+�*�eX9��E��i�/�\;��:�8bG�((ema!� �6�o�}Zs'%COd�
�YP]��[BT�vWL?F�Ch_"!�x"'��j�j�4�x�o�CD<Y#!*�vYyv�#�e�JU>�+i[�9*-Jc+`�S;?lcyg��l�3qvN�h�iKa��K�P�"�q����!��a�0mvK0<tI	D�[��7�fj�wld:,"�P�S�^
g�2�$�({P_R�U��vD9�{�)P�Anf�YD8�5PgH�#�q�EgS�d27�}��W>�Y��y�{A\<	�z�kZ� �p�+�*�eX9��E��i�/�\;��:�8bG�((ema!� �6�o�}Zs'%COd�
�YP]��[BT�vWL?F�Ch_"!�x"'��j�j�4�x�o�CD<Y#!*�vYyv�#�e�JU>�+i[�9*-Jc+`�S;?lcyl"���3qvN�h�iKa��K�P�"�q����!��a�0mvK0<tI	D�[��7�fj�wld:,"�P�S�^
g�2�$�({P_R�U��vD9�{�)P�Anf�YD8�5PgH�#�q�EgS�d27�}��W>�Y��y�{A\<	�z�kZ� �p�+�*�eX9��E��i�/�\;��:�8bG�((ema!� �6�o�}Zs'%COd�
�YP]��[BT�vWL?F�Ch_"!�x"'��j�j�4�x�o�CD<Y#!*�vYyv�#�e�JU>�+i[�9*-Jc+`�S;?lcy(
uassertRaisesu	TypeErrorumathuloguftestueu
ValueErroruNINFuassertEqualuINFu
assertTrueuisnanuNAN(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestLogys#uMathTests.testLogcCsE|jttj�d}|jtj|�tjt|���dS(NiiZl(uassertRaisesu	TypeErrorumathulog1puassertAlmostEqualufloat(uselfun((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	testLog1p�suMathTests.testLog1pcCs�|jttj�|jtjd�d�|jtjd�d�|jtjd�d�|jtjd�d�|jtjd�d
�|jtjd�d�|jttjd�|jttjt�|jtjtjt	���dS(Nigig�?ig@i�g��@ig�@i�g@�@g�?lElEl� g��(
uassertRaisesu	TypeErrorumathulog2uassertEqualu
ValueErroruNINFu
assertTrueuisnanuNAN(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestLog2�suMathTests.testLog2i
icCsLdd�tdd�D�}dd�tdd�D�}|j||�dS(NcSs+g|]!}tjtjd|���qS(g�?(umathulog2uldexp(u.0un((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu
<listcomp>�s	u+MathTests.testLog2Exact.<locals>.<listcomp>i2icSsg|]}t|��qS((ufloat(u.0un((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu
<listcomp>�s	i���i���(urangeuassertEqual(uselfuactualuexpected((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu
testLog2Exact�suMathTests.testLog2ExactcCs|jttj�|jdtjd�d�|jdtjd�d�|jdtjd�d�|jdtjd
�d
�|jttjd�|jttjd�|jttjt�|jtjt	�t	�|j
tjtjt���dS(Nu
log10(0.1)g�������?iulog10(1)iu	log10(10)i
ulog10(10**1000)i�g@�@g�?i����l�3qvN�h�iKa��K�P�"�q����!��a�0mvK0<tI	D�[��7�fj�wld:,"�P�S�^
g�2�$�({P_R�U��vD9�{�)P�Anf�YD8�5PgH�#�q�EgS�d27�}��W>�Y��y�{A\<	�z�kZ� �p�+�*�eX9��E��i�/�\;��:�8bG�((ema!� �6�o�}Zs'%COd�
�YP]��[BT�vWL?F�Ch_"!�x"'��j�j�4�x�o�CD<Y#!*�vYyv�#�e�JU>�+i[�9*-Jc+`�S;?lcyg��l�3qvN�h�iKa��K�P�"�q����!��a�0mvK0<tI	D�[��7�fj�wld:,"�P�S�^
g�2�$�({P_R�U��vD9�{�)P�Anf�YD8�5PgH�#�q�EgS�d27�}��W>�Y��y�{A\<	�z�kZ� �p�+�*�eX9��E��i�/�\;��:�8bG�((ema!� �6�o�}Zs'%COd�
�YP]��[BT�vWL?F�Ch_"!�x"'��j�j�4�x�o�CD<Y#!*�vYyv�#�e�JU>�+i[�9*-Jc+`�S;?lcyl"���3qvN�h�iKa��K�P�"�q����!��a�0mvK0<tI	D�[��7�fj�wld:,"�P�S�^
g�2�$�({P_R�U��vD9�{�)P�Anf�YD8�5PgH�#�q�EgS�d27�}��W>�Y��y�{A\<	�z�kZ� �p�+�*�eX9��E��i�/�\;��:�8bG�((ema!� �6�o�}Zs'%COd�
�YP]��[BT�vWL?F�Ch_"!�x"'��j�j�4�x�o�CD<Y#!*�vYyv�#�e�JU>�+i[�9*-Jc+`�S;?lcy(
uassertRaisesu	TypeErrorumathulog10uftestu
ValueErroruNINFuassertEqualuloguINFu
assertTrueuisnanuNAN(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	testLog10�suMathTests.testLog10cs��jttj��fdd�}|dtjd�d�|dtjd�d��jtjt�dtf��jtjt�dtf�tjt�}�jtj	|d	���jtj	|d
��dS(Ncs`||\}}\}}t||�tks?t||�r\�jd|||f�ndS(Nu%s returned %r, expected %r(uabsuepsufail(unameuresultuexpecteduv1uv2ue1ue2(uself(u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestmodf�s&	u$MathTests.testModf.<locals>.testmodfu	modf(1.5)g�?g�?g�?u
modf(-1.5)gii(g�?g�?g��g�g�(g�g�g�(
uassertRaisesu	TypeErrorumathumodfuassertEqualuINFuNINFuNANu
assertTrueuisnan(uselfutestmodfumodf_nan((uselfu3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestModf�suMathTests.testModfcCs�|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�|jtjd
t�d
�|jtjd
d�d
�|jtjd
d�d
�|jtjd
d
�d
�|jtjd
d
�d	�|jtjd
d!�d	�|jttjd
d"�|jttjd
d#�|jttjd
d$�|jttjd
t�|jtj	tjd
t
���|jtjtt�t�|jtjtd�t�|jtjtd�t�|jtjtd
�t�|jtjtd
�d	�|jtjtd%�d	�|jtjtd&�d
�|jtjtd'�d
�|jtjtd(�d
�|jtjtt�d
�|jtj	tjtt
���|jtjd)t�d
�|jtjd*d�d+�|jtjd,d�d
�|jtjd-d
�d
�|jtjd.d
�d	�|jtjd/d0�d	�|jttjd1d2�|jttjd3d4�|jttjd5d6�|jttjd7t�|jtj	tjd8t
���|jtjtt�t�|jtjtd�t�|jtjtd�t�|jtjtd
�t�|jtjtd
�d	�|jtjtd9�d	�|jtjtd:�d
�|jtjtd;�d
�|jtjtd<�d=�|jtjtt�d
�|jtj	tjtt
���|jtjd>t�d	�|jtjd?d�d@�|jttjdAd�|jtjdBd
�d	�|jtjdCd
�d	�|jtjdDdE�d	�|jtjdFdG�d	�|jttjdHdI�|jtjdJdK�dL�|jtjdMt�d	�|jtj	tjdNt
���|jtjd	t�d	�|jtjd	d�d	�|jtjd	d�d	�|jtjd	d
�d	�|jtjd	d
�d	�|jtjd	dO�d	�|jtjd	dP�d	�|jtjd	dQ�d	�|jtjd	dR�d	�|jtjd	t�d	�|jtjd	t
�d	�|jtjdd
�d	�|jtjdSd
�d	�|jtjt
d
�d	�|jtjddT�d	�|jtjdUdV�d	�|jtjt
dW�d	�|jttjdXd�|jttjdYdZ�|jtjdt�d
�|jtjdt�d
�|jtjdt�t�|jtjdt�t�|jtjd[t�t�|jtjd\t�t�|jtjd]t�d
�|jtjd^t�d
�|jtjdt�t�|jtjdt�t�|jtjdt�d
�|jtjdt�d
�|jtjd_t�d
�|jtjd`t�d
�|jtjdat�t�|jtjdbt�t�|jdtjdcd�dd�|jdtjded
�d�|jdtjdfd	�dg�|jdtjdhd
�d	�|jdtjdidj�d	�|jdtjdkdl�dm�|jdtjdndo�d�|jdtjdpdq�dr�|jttjdsdt�|jttjdud�dS(vNupow(0,1)iiupow(1,0)upow(2,1)iu	pow(2,-1)g�?g�?gg@gffffff@g@g.@g������@gffffff�?g�������?g�������?g�������?u	(-2.)**3.g @u	(-2.)**2.g@u	(-2.)**1.u	(-2.)**0.u
(-2.)**-0.u
(-2.)**-1.u
(-2.)**-2.g�?u
(-2.)**-3.g�?i����g�g�gffffff�g�g�g�gffffff�g�g�g�g�g�g�g�g�g�g�g�g�gffffff�g�g�g�g�g�g�gffffff�g�g�g�g�g�g�g�g�g�g�g�g�g�gffffff�g�g�g�g�g�g�g�gffffff�g�gffffff�g�gffffff�g�g�g�g.�g�������g��������g�������g�������gffffff��g��������g�������g�������gffffff��g�g �g�g�g�g�g�g�g�g�g�g�g�g�g�g��g�g�g�(uassertRaisesu	TypeErrorumathupowuftestuassertEqualuINFuNINFu
assertTrueuisnanuNANu
ValueError(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestPow�s�""""""""uMathTests.testPowcCs}|jttj�|jdtjd�tj�|jdtjd�tjd�|jdtjd	�tjd�dS(
Nuradians(180)i�uradians(90)iZiuradians(-45)i-ii���(uassertRaisesu	TypeErrorumathuradiansuftestupi(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestRadians]s#uMathTests.testRadianscCs|jttj�|jdtjd�d�|jdtjtjd�d�|jdtjtjd�d�yB|jtjtjt���|jtjtjt	���Wn>t
k
r�|jt
tjt�|jt
tjt	�YnX|jtjtjt���dS(Nusin(0)iu	sin(pi/2)iiu
sin(-pi/2)i����(uassertRaisesu	TypeErrorumathusinuftestupiu
assertTrueuisnanuINFuNINFu
ValueErroruNAN(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestSincs#$#
uMathTests.testSincCs�|jttj�|jdtjd�d�|jdtjd�dtjd�dd�|jdtjd�tjd�d�|jtjt�t�|jtjt�t�|j	tj
tjt���dS(	Nusinh(0)iusinh(1)**2-cosh(1)**2iiusinh(1)+sinh(-1)i����i����(uassertRaisesu	TypeErrorumathusinhuftestucoshuassertEqualuINFuNINFu
assertTrueuisnanuNAN(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestSinhps1)uMathTests.testSinhcCs�|jttj�|jdtjd�d�|jdtjd�d�|jdtjd�d�|jtjt�t�|jttjt�|j	tj
tjt���dS(Nusqrt(0)iusqrt(1)iusqrt(4)ii(uassertRaisesu	TypeErrorumathusqrtuftestuassertEqualuINFu
ValueErroruNINFu
assertTrueuisnanuNAN(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestSqrtysuMathTests.testSqrtc
Cs|jttj�|jdtjd�d�|jdtjtjd�d�|jdtjtjd�d�yB|jtjtjt���|jtjtjt	���Wn4|jt
tjt�|jt
tjt	�YnX|jtjtjt���dS(Nutan(0)iu	tan(pi/4)iiu
tan(-pi/4)i����(uassertRaisesu	TypeErrorumathutanuftestupiu
assertTrueuisnanuINFuNINFu
ValueErroruNAN(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestTan�s#$#uMathTests.testTancCs�|jttj�|jdtjd�d�|jdtjd�tjd�d�|jdtjt�d�|jdtjt�d�|jtjtjt	���dS(	Nutanh(0)iutanh(1)+tanh(-1)iu	tanh(inf)u
tanh(-inf)i����i����(
uassertRaisesu	TypeErrorumathutanhuftestuINFuNINFu
assertTrueuisnanuNAN(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestTanh�s)uMathTests.testTanhuTANH_PRESERVES_ZERO_SIGNiu,system tanh() function doesn't copy the signcCsN|jtjd�d�|jtjdtjd��tjdd��dS(Ngg�?g�g�g�g�(uassertEqualumathutanhucopysign(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestTanhSign�suMathTests.testTanhSigncCs�|jtjd�d�|jtjd�d�|jttjd��t�|jttjd��t�|jtjd�d�|jtjd�d�|jtjd�d�|jtjd�d�|jtjd�d�|jtjd�d�Gdd	�d	t�}Gd
d�dt�}|jtj|��d�|jttj�|jttjdd
�|jttj|��dS(Nig�?g����?g�!��?ig-���?Y@idcBs |EeZdZdd�ZdS(u'MathTests.test_trunc.<locals>.TestTrunccSsdS(Ni((uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	__trunc__�su1MathTests.test_trunc.<locals>.TestTrunc.__trunc__N(u__name__u
__module__u__qualname__u	__trunc__(u
__locals__((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	TestTrunc�su	TestTrunccBs|EeZdZdS(u)MathTests.test_trunc.<locals>.TestNoTruncN(u__name__u
__module__u__qualname__(u
__locals__((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyuTestNoTrunc�suTestNoTrunciii����i����g��i����g�����i����g�!��ig-���?Y�i����(uassertEqualumathutruncutypeuintuobjectuassertRaisesu	TypeError(uselfu	TestTruncuTestNoTrunc((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu
test_trunc�s uMathTests.test_trunccCs�|jtjd��|jtjd��|jtjd��|jtjd��|jtjtd���|jtjtd���|jtjtd���dS(Ngg�?unanuinfu-infg�g�(u
assertTrueumathuisfiniteuassertFalseufloat(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutestIsfinite�suMathTests.testIsfinitecCs�|jtjtd���|jtjtd�d��|jtjtd���|jtjd��|jtjd��dS(Nunanuinfgg�?(u
assertTrueumathuisnanufloatuassertFalse(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	testIsnan�s
 uMathTests.testIsnancCs�|jtjtd���|jtjtd���|jtjd��|jtjd��|jtjtd���|jtjd��|jtjd��dS(Nuinfu-infg�unangg�?g�(u
assertTrueumathuisinfufloatuassertFalse(uself((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	testIsinf�suMathTests.testIsinfurequires verbose modecCs�ytjd�}Wn|jd�YnX|dkrG|jd�nytjd�}Wntk
rnYnX|jd�ytjd	�}Wntk
r�YnX|jd�dS(
Niʚ;u6underflowing exp() should not have raised an exceptioniu)underflowing exp() should have returned 0u.overflowing exp() didn't trigger OverflowErrorg�?u sqrt(-1) didn't raise ValueErrori6e�g�(umathuexpufailu
OverflowErrorusqrtu
ValueError(uselfux((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutest_exceptions�s 


uMathTests.test_exceptionscCs0x)tt�D]\}}}}}}}|dks
|dks
|rLq
n|d
kr^q
ntt|�}y||�}	Wn�tk
r�}
z3dd|
jd|||f}|j|�WYdd}
~
Xn6tk
rdd|||f}|j|�YnX|jd	|||f|	|�q
WdS(Ngurectupolaru"Unexpected ValueError: %s
        uin test %s:%s(%r)
iuUnexpected OverflowError in utest %s:%s(%r)
u	%s:%s(%r)(urectupolar(	uparse_testfileu	test_fileugetattrumathu
ValueErroruargsufailu
OverflowErroruftest(uselfuidufnuaruaiuerueiuflagsufuncuresultuexcumessage((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu
test_testfile�s"(
uMathTests.test_testfilecCs:d}g}xtt�D]�\}}}}}tt|�}d|ksUd|kr^d}nd|krsd}ny||�}	Wn/tk
r�d}	Yntk
r�d}	YnXd}
t|	t�r�t|t�r�tj	|�r�tj	|	�r�qntj	|�r�tj	|	�r�|dkrGt
||	dd	d
d	�}
n3|dkrht||	d�}
nt||	d
�}
|
dkr�qq�q�nt|	t�r�t|t�r�|	|kr�qq�n|j
|||||	�}|
dk	r|dj
|
�7}n|j|�qW|r6|jddj|��ndS(Nu${}:{}({!r}): expected {!r}, got {!r}uinvalidudivide-by-zerou
ValueErroruoverflowu
OverflowErrorulgammaurel_errg�+�����<uabs_erruerfci�iu ({})uFailures in test_mtestfile:
  u
  (uparse_mtestfileumath_testcasesugetattrumathu
ValueErroru
OverflowErroruNoneu
isinstanceufloatuisnanu	acc_checku
ulps_checkustruformatuappendufailujoin(uselfufail_fmtufailuresuidufnuarguexpecteduflagsufuncugotuaccuracy_failureufail_msg((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyutest_mtestfilesL"		


 		uMathTests.test_mtestfileN(9u__name__u
__module__u__qualname__uftestu
testConstantsutestAcosu	testAcoshutestAsinu	testAsinhutestAtanu	testAtanhu	testAtan2utestCeilurequires_IEEE_754utestCopysignutestCosutestCoshutestDegreesutestExputestFabsu
testFactorialu	testFloorutestFmodu	testFrexpuunittestuskipIfuHAVE_DOUBLE_ROUNDINGutestFsumu	testHypotu	testLdexputestLogu	testLog1putestLog2usupporturequires_mac_veru
testLog2Exactu	testLog10utestModfutestPowutestRadiansutestSinutestSinhutestSqrtutestTanutestTanhu	sysconfiguget_config_varutestTanhSignu
test_truncutestIsfiniteu	testIsnanu	testIsinfu
skipUnlessuverboseutest_exceptionsu
test_testfileutest_mtestfile(u
__locals__((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	MathTests�sb		
			="		Y !�
		
	 u	MathTestscCsSddlm}tj�}|jtjt��|j|d��t|�dS(Ni(uDocFileSuiteuieee754.txt(udoctestuDocFileSuiteuunittestu	TestSuiteuaddTestu	makeSuiteu	MathTestsurun_unittest(uDocFileSuiteusuite((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu	test_mainKs
u	test_main(+utest.supporturun_unittestuverboseurequires_IEEE_754utestusupportuunittestumathuosuplatformusysustructu	sysconfiguepsufloatuNANuINFuNINFuxuyuHAVE_DOUBLE_ROUNDINGu__name__uargvufileu__file__upathudirnameucurdirutest_dirujoinumath_testcasesu	test_fileuto_ulpsu
ulps_checkucount_set_bitsupartial_productupy_factorialu	acc_checkuparse_mtestfileuparse_testfileuTestCaseu	MathTestsu	test_main(((u3/opt/alt/python33/lib64/python3.3/test/test_math.pyu<module>sF!����