ó 2ÄÈ[c@`s›ddlmZmZmZddlZddlZddlZddlmZm Z m Z m Z ddl m Z mZd„Zdefd„ƒYZdS(i(tdivisiontabsolute_importtprint_functionN(tuint16tfloat16tfloat32tfloat64(tassert_t assert_equalcO`sby|||ŽWn9tk rL}tt|ƒj|ƒdkd|ƒnXttd|ƒdS(Nis%Did not raise floating point %s error(tFloatingPointErrorRtstrtfindtFalse(tstrmatchtcallabletargstkwargstexc((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pytassert_raises_fpe stTestHalfcB`s¡eZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z e jjejƒd kd d ƒd„ƒZd„ZRS(cC`stjddtƒ|_t|j_tj|jdtƒ|_tj|jdt ƒ|_ tj tjddddtƒtjddddtƒfƒ|_ t|j _tj|j dtƒ|_ tj|j dt ƒ|_|j dd!|_|j dd!|_|jdd!|_dS( Nitdtypeiüiÿiÿÿÿÿii|i(tnptarangeRtall_f16RRtarrayRtall_f32Rtall_f64t concatenatet nonan_f16t nonan_f32t nonan_f64t finite_f16t finite_f32t finite_f64(tself((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pytsetups $ cC`s%tj|jdtƒ}t|jjdtƒ|jdtƒƒtj|jdtƒ}t|jjdtƒ|jdtƒƒtj|j dtj ƒ}tj|dtƒ}t|j jdtƒ|jdtƒƒtj ddƒ}tj|dtƒ}tj|dt ƒ}t||ƒdS(s[Checks that all 16-bit values survive conversion to/from 32-bit and 64-bit floatRiøÿÿiN( RRRRRRtviewRRRt longdoubleRtint(R"tbta_ldti_intti_f16tj((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyttest_half_conversions*scC`stjddƒýttj|jƒtj|jƒƒttj|jƒtj|jƒƒttj|jƒtj|jƒƒttj|jƒtj|jƒƒttj t dƒƒtj ƒt tj ƒ}t |j|kjƒ ƒt ||jkjƒ ƒt |j|kjƒƒt ||jkjƒƒt |j|kjƒ ƒt ||jkjƒ ƒt |j|kjƒ ƒt ||jkjƒ ƒt |j|kjƒ ƒt ||jkjƒ ƒt |j|kjƒ ƒt ||jkjƒ ƒWdQXdS(Ntalltignoreiàÿ(RterrstateRtisnanRRtisinftisfinitetsignbittspacingRtinftnanRtanyR-(R"R6((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyttest_nans_infsHs&%%%%cC`s¥tjdddddddddd!d"d$d d%tjtj gƒ}tjddddddddddddd dddgdtƒ}t|_t||ƒdS(&s,Confirms a small number of known half valuesgð?gð¿g@gÀg˜¹?gTÕ?iàÿi ÿÿiòÿÿÿièÿÿÿiiÿÿÿÿgði<i¼i@iÀif.iU5iÿ{iÿûii„ii€i€i|iüRNg?g?g¿gp>gp>gp¾g€(RRR5RRRR(R"taR'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyttest_half_valuesfs$   c C`sÃtjdddddddddddd d gd tƒ}dd d dddddtjg}tj|d tƒ}t||ƒtj|d tƒ}tj|d tƒ}t||ƒdS(s7Checks that rounding when converting to half is correctg@içÿÿÿiÝÿÿÿiæÿÿÿgð?iõÿÿÿiðÿÿÿiôÿÿÿiïÿiðÿRièÿÿÿgiöÿÿÿiàÿNg`>gÀ=g`>gP>g@?gð>g@?g0?gp>gP?(RRRR5RRR(R"R9troundedR'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyttest_half_rounding{s,      c C`so|jjdtƒ}d|d@d?}tj|d@d?dtjƒd}|d@d}||d kcd 7 %g != %gNgP?( RR$RRRtint32tnonzeroR tlenRR!( R"ta_bitsta_sgnta_expta_manta_manualta32_failt bad_indexta64_fail((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyttest_half_correctness˜s.$        cC`s4|jddd…jƒ}tj|dtƒ}|jƒ|jƒt||ƒt|d |dkjƒƒt|d |dkj ƒ ƒt|d|d kjƒƒt|d|d kj ƒ ƒttj |d |dkƒdj |j dƒttj |d|d kƒdj |j dƒdS(s'Make sure comparisons are working rightNiÿÿÿÿRiii( RtcopyRRRtsortRRR-R7R>tsize(R"R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyttest_half_ordering¼s   2c C`sttjddtƒtjddtƒƒtjddtƒ}|jdƒt|tjddtƒƒtjddddddd gdtƒ}t|j ƒdd dd gƒ|j ƒj ƒ}t|j ƒdd dd gƒtjddd dtƒ}tjddtƒ}ttj ||ƒdƒtjdtj dd ddddgdtƒ}t|jƒdƒtjdtj dtj dtjddgdtƒ}t|jƒdƒtjddtƒ}x*tdƒD]}t|j|ƒ|ƒqÞWdS(sTest the various ArrFuncsi Riiiiÿÿÿÿg@Œµx¯Dg@ièÿÿÿg‹ÖT“ÿß>iigà?ii_iþÿÿÿgš™™™™)@g333333@gÍÌÌÌÌÌ@gÍÌÌÌÌÌ(@iN(i(ig#B’ ¡œÇ»gp>(i(RRRRRtzerostfilltonesRR>tbyteswapt newbyteordertdotR5targmaxR6trangetitem(R"R9R'ti((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyttest_half_funcsÓs0 *1 7 cC`sŽtjddtƒ}tjtjfdtƒ}|jdtƒ}ttj|d ƒ|d|d ƒttj |d |ƒ|dƒttj |d| ƒ|d ƒttj |d| ƒ|d ƒ|dO}ttj|dƒtj|dƒƒttj|dƒ|d |dƒttj |d|ƒ|d ƒttj |d|ƒ|d ƒttj |d | ƒ|dƒdS(s Test np.spacing and np.nextafteri|Riÿÿÿÿiii€N( RRRRR5RR$RR4t nextafter(R"R9thinfta_f16((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyttest_spacing_nextafterús&!#" '&"!cC`s)tjdddddgdtƒ}tjdddddgdtƒ}tjdd tj tjd gdtƒ}ttj||ƒdd dd dgƒttj||ƒdd ddd gƒttj||ƒdddd d gƒttj ||ƒdddddgƒttj ||ƒt t t t t gƒttj ||ƒt t t t t gƒttj||ƒt t t t t gƒttj||ƒt t t t t gƒttj||ƒt t t t t gƒttj||ƒt t t t t gƒttj||ƒt t t t t gƒttj||ƒt t t t t gƒttj||ƒt t t t t gƒttj|ƒt t t t t gƒttj|ƒt t t t t gƒttj|ƒt t t t t gƒttj|ƒt t t t t gƒttj|ƒt t t t t gƒttj||ƒdddddgƒttj||ƒdddddgƒtj||ƒ}ttj|dƒƒd|dƒtd?ƒtjtd(ƒƒtjtd%ƒttj ƒƒtjtd(ƒttjƒƒtd@ƒtdAƒtdCƒtdDƒtdEdFƒtdƒtdHdIƒtdƒWdQXdS(JNR-traiseg-Cëâ6?RgˆÃ@t underflowcS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pytqscS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹rscS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹sscS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹tscS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹uscS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹vscS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹wscS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹xscS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹ysg@iòÿÿÿii cS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹{scS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹}sièÿÿÿcS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹scS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹siéÿÿÿitoverflowcS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹…scS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹†scS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹‡scS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹ˆscS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹‰scS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹ŠscS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹‹scS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹ŒscS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹siàÿicS`s||S(N((R9R'((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR‹si ÿÿtinvalidiiÀÿi ióÿÿÿi (g-Cëâ6?(gˆÃ@g?ig?g¿ig?gp>g?g¿gp>g?g€>g ?g?ig?ig?g¿ig?g€>g?g¿g€>( RR/RRRRXR5R4R_R6(R"tsx16tbx16tsy16tby16((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyt test_half_fpegsl         %&(%&% cC`spddd„ƒY}tjddtƒ}|ƒ}|j|_tj|ƒ}t|jtkƒt||ƒdS(s5Test that half is compatible with __array_interface__tDummycB`seZRS((t__name__t __module__(((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyR“«siRN((i(RRORt__array_interface__RRRR(R"R“R9R'R~((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyttest_half_array_interface©s  (R”R•R#R,R8R:R<RHRLRWR[R€R†tpytesttmarktskipiftplatformtmachineR’R—(((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyRs      $  '  < A(t __future__RRRR›R˜tnumpyRRRRRt numpy.testingRRRtobjectR(((s9/tmp/pip-build-fiC0ax/numpy/numpy/core/tests/test_half.pyts   "