B
     \T                 @   s   d dl mZmZmZ d dlZd dlZd dlZd dlZd dlZ	d dl
mZ d dlmZmZmZ d dl
mZmZ d dlmZmZmZ ddlmZmZmZ e Zed	 e Zd
d Zdd Zdd Z dd Z!dd Z"dd Z#dd Z$dd Z%dd Z&dd Z'dd Z(d d! Z)d"d# Z*d$d% Z+d&d' Z,d(d) Z-d*d+ Z.d,d- Z/d.d/ Z0d0d1 Z1d2d3 Z2d4d5 Z3d6d7 Z4d8d9 Z5d:d; Z6d<d= Z7d>d? Z8d@dA Z9dBdC Z:dDdE Z;dFdG Z<dHdI Z=dJdK Z>dLdM Z?dNdO Z@dPdQ ZAdRdS ZBdTdU ZCG dVdW dWeZDeEdXkreF  dS )Y    )print_functionabsolute_importdivisionN)unittest_support)compile_isolatedFlagsutils)typesnumpy_support)	PYVERSIONIS_WIN32	IS_32BITS   )TestCaseCompilationCachetagZenable_pyobjectc             C   s
   t | S )N)mathsin)x r   7lib/python3.7/site-packages/numba/tests/test_mathlib.pyr      s    r   c             C   s
   t | S )N)r   cos)r   r   r   r   r      s    r   c             C   s
   t | S )N)r   tan)r   r   r   r   r      s    r   c             C   s
   t | S )N)r   sinh)r   r   r   r   r   "   s    r   c             C   s
   t | S )N)r   cosh)r   r   r   r   r   &   s    r   c             C   s
   t | S )N)r   tanh)r   r   r   r   r   *   s    r   c             C   s
   t | S )N)r   asin)r   r   r   r   r   .   s    r   c             C   s
   t | S )N)r   acos)r   r   r   r   r   2   s    r   c             C   s
   t | S )N)r   atan)r   r   r   r   r   6   s    r   c             C   s   t | |S )N)r   atan2)yr   r   r   r   r   :   s    r   c             C   s
   t | S )N)r   asinh)r   r   r   r   r!   >   s    r!   c             C   s
   t | S )N)r   acosh)r   r   r   r   r"   B   s    r"   c             C   s
   t | S )N)r   atanh)r   r   r   r   r#   F   s    r#   c             C   s
   t | S )N)r   sqrt)r   r   r   r   r$   J   s    r$   c             C   s
   t | S )N)npr$   )r   r   r   r   npy_sqrtN   s    r&   c             C   s
   t | S )N)r   exp)r   r   r   r   r'   R   s    r'   c             C   s
   t | S )N)r   expm1)r   r   r   r   r(   V   s    r(   c             C   s
   t | S )N)r   log)r   r   r   r   r)   Z   s    r)   c             C   s
   t | S )N)r   log1p)r   r   r   r   r*   ^   s    r*   c             C   s
   t | S )N)r   log10)r   r   r   r   r+   b   s    r+   c             C   s
   t | S )N)r   floor)r   r   r   r   r,   f   s    r,   c             C   s
   t | S )N)r   ceil)r   r   r   r   r-   j   s    r-   c             C   s
   t | S )N)r   trunc)r   r   r   r   r.   n   s    r.   c             C   s
   t | S )N)r   isnan)r   r   r   r   r/   r   s    r/   c             C   s
   t | S )N)r   isinf)r   r   r   r   r0   v   s    r0   c             C   s
   t | S )N)r   isfinite)r   r   r   r   r1   z   s    r1   c             C   s   t | |S )N)r   hypot)r   r    r   r   r   r2   ~   s    r2   c             C   s
   t | S )N)r   degrees)r   r   r   r   r3      s    r3   c             C   s
   t | S )N)r   radians)r   r   r   r   r4      s    r4   c             C   s
   t | S )N)r   erf)r   r   r   r   r5      s    r5   c             C   s
   t | S )N)r   erfc)r   r   r   r   r6      s    r6   c             C   s
   t | S )N)r   gamma)r   r   r   r   r7      s    r7   c             C   s
   t | S )N)r   lgamma)r   r   r   r   r8      s    r8   c             C   s   t | |S )N)r   pow)r   r    r   r   r   r9      s    r9   c             C   s   t | |S )N)r   copysign)r   r    r   r   r   r:      s    r:   c             C   s
   t | S )N)r   frexp)r   r   r   r   r;      s    r;   c             C   s   t | |S )N)r   ldexp)r   er   r   r   r<      s    r<   c               C   s   t jt jfS )N)r   Zpir=   r   r   r   r   get_constants   s    r>   c               @   sH  e Zd Zdd Zdd ZedfddZedfdd	Zefd
dZefddZ	e
ddd ZeejdkdefddZe
ddd ZefddZe
ddd ZefddZe
ddd Zefdd Zd!d" Zefd#d$Ze
dd%d& Zefd'd(Ze
dd)d* Zefd+d,Ze
dd-d. Zefd/d0Ze
dd1d2 Zefd3d4Z e
dd5d6 Z!efd7d8Z"e
dd9d: Z#efd;d<Z$e
dd=d> Z%efd?d@Z&e
ddAdB Z'efdCdDZ(e
ddEdF Z)efdGdHZ*e
ddIdJ Z+efdKdLZ,e
ddMdN Z-efdOdPZ.e
ddQdR Z/efdSdTZ0e
ddUdV Z1efdWdXZ2e
ddYdZ Z3efd[d\Z4e
dd]d^ Z5efd_d`Z6e
ddadb Z7efdcddZ8e
ddedf Z9efdgdhZ:e
ddidj Z;dkdl Z<e
ddmdn Z=dodp Z>e
ddqdr Z?ee@jAdsk dtdudv ZBee@jAdsk dtdwdx ZCefdydzZDe
dd{d| ZEefd}d~ZFdd ZGefddZHdd ZIefddZJdd ZKefddZLdd ZMeeAdkoeNoeO defddZPdd ZQefddZRdd ZSefddZTe
ddd ZUefddZVe
ddd ZWefddZXdd ZYefddZZdd Z[dS )TestMathLibc             C   s   t  | _d S )N)r   ccache)selfr   r   r   setUp   s    zTestMathLib.setUpc             C   s   |  tt d S )N)Zrun_nullary_funcr>   no_pyobj_flags)rA   r   r   r   test_constants   s    zTestMathLib.test_constantsexactc             K   s|   xvt ||D ]h\}}| jj||f|d}	|	j}
|
|}||}|tjkrLdn|}d|f }| j||f||d| qW d S )N)flagssinglezfor input %r)precmsg)zipr@   compileentry_pointr	   float32assertPreciseEqual)rA   pyfuncx_typesx_valuesrF   rH   kwargsZtxZvxcrcfuncgotexpectedactual_precrI   r   r   r   	run_unary   s    
zTestMathLib.run_unaryc             C   s   xzt |||D ]j\}}}	| jj|||f|d}
|
j}|||	}|||	}|tjkrVdn|}d||	f }| j||||d qW d S )N)rF   rG   zfor inputs (%r, %r))rH   rI   )rJ   r@   rK   rL   r	   rM   rN   )rA   rO   rP   rQ   y_valuesrF   rH   Ztyr   r    rS   rT   rU   rV   rW   rI   r   r   r   
run_binary   s    

zTestMathLib.run_binaryc             C   st   t jt jt jt jt jt jt jt jt jt jt jt jg}ddddddt	ddt	dt	ddt	dg}| 
|||| d S )Nr   infg        nan)r	   int16int32int64uint16uint32uint64rM   float64floatrX   )rA   rO   rF   rP   rQ   r   r   r   check_predicate_func   s    z TestMathLib.check_predicate_funcc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )N   r   g?g?)r   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   test_sin   s    zTestMathLib.test_sinZ	importantc             C   s   | j td d S )N)rF   )ri   rC   )rA   r   r   r   test_sin_npm   s    zTestMathLib.test_sin_npmwin32z'not exactly equal on win32 (issue #597)c             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )Nrf   rg   rh   r   g?g?)r   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   test_cos   s    zTestMathLib.test_cosc             C   s   | j td d S )N)rF   )rl   rC   )rA   r   r   r   test_cos_npm   s    zTestMathLib.test_cos_npmc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )Nrf   rg   rh   r   g?g?)r   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   test_tan   s    zTestMathLib.test_tanc             C   s   | j td d S )N)rF   )rn   rC   )rA   r   r   r   test_tan_npm   s    zTestMathLib.test_tan_npmc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )Nrh   r   g?g?)r$   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   	test_sqrt   s    zTestMathLib.test_sqrtc             C   s   | j td d S )N)rF   )rp   rC   )rA   r   r   r   test_sqrt_npm  s    zTestMathLib.test_sqrt_npmc             C   sh   t }ddddddddg}tjtjg}| j||||dd tjtjtjtjtj	tj
g}| |||| d S )Nrh   r   g?g?rG   )rH   )r&   r	   r]   r`   rX   r^   r_   ra   rb   rM   rc   )rA   rF   rO   rQ   rP   r   r   r   test_npy_sqrt	  s    zTestMathLib.test_npy_sqrtc             C   s   | j td d S )N)rF   )rr   rC   )rA   r   r   r   test_npy_sqrt_npm  s    zTestMathLib.test_npy_sqrt_npmc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )Nrf   rg   rh   r   g?g?)r'   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   test_exp  s    zTestMathLib.test_expc             C   s   | j td d S )N)rF   )rt   rC   )rA   r   r   r   test_exp_npm  s    zTestMathLib.test_exp_npmc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )Nrf   rg   rh   r   g?g?)r(   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   
test_expm1#  s    zTestMathLib.test_expm1c             C   s   | j td d S )N)rF   )rv   rC   )rA   r   r   r   test_expm1_npm+  s    zTestMathLib.test_expm1_npmc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )	Nr   
   d   i  i i@B g?g?)r)   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   test_log/  s    zTestMathLib.test_logc             C   s   | j td d S )N)rF   )rz   rC   )rA   r   r   r   test_log_npm7  s    zTestMathLib.test_log_npmc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )	Nr   rx   ry   i  i i@B g?g?)r*   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   
test_log1p;  s    zTestMathLib.test_log1pc             C   s   | j td d S )N)rF   )r|   rC   )rA   r   r   r   test_log1p_npmC  s    zTestMathLib.test_log1p_npmc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )	Nr   rx   ry   i  i i@B g?g?)r+   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   
test_log10G  s    zTestMathLib.test_log10c             C   s   | j td d S )N)rF   )r~   rC   )rA   r   r   r   test_log10_npmO  s    zTestMathLib.test_log10_npmc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )Nr   g      ?)r   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   	test_asinS  s    zTestMathLib.test_asinc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_asin_npm[  s    zTestMathLib.test_asin_npmc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )Nr   g      ?)r   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   	test_acos_  s    zTestMathLib.test_acosc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_acos_npmg  s    zTestMathLib.test_acos_npmc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )Nrf   rg   rh   r   g?g?)r   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   	test_atank  s    zTestMathLib.test_atanc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_atan_npms  s    zTestMathLib.test_atan_npmc             C   s`   t }tjtjtjtjtjtjtjtj	g}ddddddddg}dd |D }| 
||||| d S )	Nrf   rg   rh   r   g?g?c             S   s   g | ]}|d  qS )rh   r   ).0r   r   r   r   
<listcomp>}  s    z*TestMathLib.test_atan2.<locals>.<listcomp>)r   r	   r]   r^   r_   r`   ra   rb   rM   rc   rZ   )rA   rF   rO   rP   rQ   rY   r   r   r   
test_atan2w  s    zTestMathLib.test_atan2c             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_atan2_npm  s    zTestMathLib.test_atan2_npmc             C   sT   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| j
||||dd d S )Nr   g      ?double)rH   )r!   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   
test_asinh  s    zTestMathLib.test_asinhc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_asinh_npm  s    zTestMathLib.test_asinh_npmc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )Nr   g      ?)r"   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   
test_acosh  s    zTestMathLib.test_acoshc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_acosh_npm  s    zTestMathLib.test_acosh_npmc             C   sT   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| j
||||dd d S )Nr   g?r   )rH   )r#   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   
test_atanh  s    zTestMathLib.test_atanhc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_atanh_npm  s    zTestMathLib.test_atanh_npmc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )Nr   g      ?)r   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   	test_sinh  s    zTestMathLib.test_sinhc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_sinh_npm  s    zTestMathLib.test_sinh_npmc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )Nr   g      ?)r   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   	test_cosh  s    zTestMathLib.test_coshc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_cosh_npm  s    zTestMathLib.test_cosh_npmc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )Nr   g?)r   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   	test_tanh  s    zTestMathLib.test_tanhc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_tanh_npm  s    zTestMathLib.test_tanh_npmc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )Nr   g?gffffff?)r,   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   
test_floor  s    zTestMathLib.test_floorc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_floor_npm  s    zTestMathLib.test_floor_npmc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )Nr   g?gffffff?)r-   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   	test_ceil  s    zTestMathLib.test_ceilc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_ceil_npm  s    zTestMathLib.test_ceil_npmc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )Nr   g?gffffff?)r.   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   
test_trunc  s    zTestMathLib.test_truncc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_trunc_npm  s    zTestMathLib.test_trunc_npmc             C   s   | j ttd d S )N)rF   )re   r/   enable_pyobj_flags)rA   r   r   r   
test_isnan  s    zTestMathLib.test_isnanc             C   s   | j ttd d S )N)rF   )re   r/   rC   )rA   r   r   r   test_isnan_npm  s    zTestMathLib.test_isnan_npmc             C   s   | j ttd d S )N)rF   )re   r0   r   )rA   r   r   r   
test_isinf  s    zTestMathLib.test_isinfc             C   s   | j ttd d S )N)rF   )re   r0   rC   )rA   r   r   r   test_isinf_npm  s    zTestMathLib.test_isinf_npm)   rh   zneeds Python 3.2+c             C   s   | j ttd d S )N)rF   )re   r1   r   )rA   r   r   r   test_isfinite  s    zTestMathLib.test_isfinitec             C   s   | j ttd d S )N)rF   )re   r1   rC   )rA   r   r   r   test_isfinite_npm  s    zTestMathLib.test_isfinite_npmc          
   C   s   t }tjtjtjtjg}ddddddddg}d	d
 |D }tjdkrHdnd}| |||||| dd }xtjtjfD ]}| j	j
|||f|d}	|	j}
t|j}|t|jd }|
||}| j||||dd | t| t $ tdt | td||| W d Q R X qvW d S )Nr   rh   r            gzG?g(\?c             S   s   g | ]}|d  qS )rh   r   )r   r   r   r   r   r     s    z*TestMathLib.test_hypot.<locals>.<listcomp>rk   rG   rE   c             S   s   t | |  ||  S )N)r   r$   )r   r    r   r   r   naive_hypot  s    z+TestMathLib.test_hypot.<locals>.naive_hypot)rF   g      >@)rH   errorz"overflow encountered in .*_scalars)r2   r	   r_   rb   rM   rc   sysplatformrZ   r@   rK   rL   r
   Zas_dtypetyper%   ZfinfomaxrN   Z
assertTruer1   warningscatch_warningssimplefilterRuntimeWarningZassertRaisesRegexp)rA   rF   rO   rP   rQ   rY   rH   r   flttyrS   rT   ZdtvalZnb_ansr   r   r   
test_hypot  s*    

zTestMathLib.test_hypotc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_hypot_npm#  s    zTestMathLib.test_hypot_npmc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )Nr   g      ?)r3   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   test_degrees'  s    zTestMathLib.test_degreesc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_degrees_npm/  s    zTestMathLib.test_degrees_npmc             C   sP   t }tjtjtjtjtjtjtjtj	g}ddddddddg}| 
|||| d S )Nr   g      ?)r4   r	   r]   r^   r_   r`   ra   rb   rM   rc   rX   )rA   rF   rO   rP   rQ   r   r   r   test_radians2  s    zTestMathLib.test_radiansc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_radians_npm:  s    zTestMathLib.test_radians_npmc          	   C   sN   t }dddddddtdg}tjtjgt|d  }| j||||d	dd
 d S )Ng      ?g      g       g        g      ?r   r[   rh   r   )rH   ulps)r5   rd   r	   rM   rc   lenrX   )rA   rF   rO   rQ   rP   r   r   r   test_erf=  s
    zTestMathLib.test_erfc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_erf_npmD  s    zTestMathLib.test_erf_npmc          	   C   sN   t }dddddddtdg}tjtjgt|d  }| j||||d	d
d d S )Ng      ?g      g       g        g      ?r   r[   rh   r   r   )rH   r   )r6   rd   r	   rM   rc   r   rX   )rA   rF   rO   rQ   rP   r   r   r   	test_erfcG  s
    zTestMathLib.test_erfcc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_erfc_npmN  s    zTestMathLib.test_erfc_npm)rh      zunknown error with tgammac             C   s|   t }ddddg}tjtjgt|d  }| j||||ddd d	d
dddtdg}tjgt| }| j||||ddd d S )Ng      ?gg      g      ?rh   r   r   )rH   r   gg?g      @g333333$@g      I@r[      )r7   r	   rM   rc   r   rX   rd   )rA   rF   rO   rQ   rP   r   r   r   
test_gammaQ  s    zTestMathLib.test_gammac             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_gamma_npm]  s    zTestMathLib.test_gamma_npmc          	   C   sL   t }dddddddtdg}tjtjgt|d	  }| j||||d
d d S )Ng      ?ggg?g      i@g    _Bgꌠ9Y>)Fr[   rh   r   )rH   )r8   rd   r	   rM   rc   r   rX   )rA   rF   rO   rQ   rP   r   r   r   test_lgamma`  s    zTestMathLib.test_lgammac             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_lgamma_npmf  s    zTestMathLib.test_lgamma_npmc             C   s`   t }tjtjtjtjtjtjtjtj	g}ddddddddg}dd |D }| 
||||| d S )	Nrf   rg   rh   r   g?g?c             S   s   g | ]}|d  qS )rh   r   )r   r   r   r   r   r   o  s    z(TestMathLib.test_pow.<locals>.<listcomp>)r9   r	   r]   r^   r_   r`   ra   rb   rM   rc   rZ   )rA   rF   rO   rP   rQ   rY   r   r   r   test_powi  s    zTestMathLib.test_powc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_pow_npmr  s    zTestMathLib.test_pow_npmc          
   C   sd   t }tjtjg}ddddddtdtdtd	g	}ttt||| \}}}| 	||||| d S )
Nrf   rg   g       g        r   rh   z-infr[   r\   )
r:   r	   rM   rc   rd   listrJ   	itertoolsproductrZ   )rA   rF   rO   Zvalue_typesvaluesrP   rQ   rY   r   r   r   test_copysignv  s    
zTestMathLib.test_copysignc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_copysign_npm  s    zTestMathLib.test_copysign_npmc             C   sF   t }tjtjg}ddddtdtdtdg}| j||||dd	 d S )
Ng      g       g        g      @z-infr[   r\   rE   )rH   )r;   r	   rM   rc   rd   rX   )rA   rF   rO   rP   rQ   r   r   r   
test_frexp  s
    zTestMathLib.test_frexpc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_frexp_npm  s    zTestMathLib.test_frexp_npmc             C   s   t }xtjtjfD ]x}| jj||tjf|d}|j}xTddddddtdd	ftd
d	ftdd	fg	D ]"}d|f }| 	|| ||  qdW qW d S )N)rF   )g      @rf   )g      @r   )g        r   )g        r   )g       r   )g       r   r[   r   z-infr\   zfor input %r)
r<   r	   rM   rc   r@   rK   r^   rL   rd   rN   )rA   rF   rO   r   rS   rT   argsrI   r   r   r   
test_ldexp  s    

zTestMathLib.test_ldexpc             C   s   | j td d S )N)rF   )r   rC   )rA   r   r   r   test_ldexp_npm  s    zTestMathLib.test_ldexp_npmN)\__name__
__module____qualname__rB   rD   r   rX   rZ   re   ri   r   rj   unittestZskipIfr   r   rl   rm   rn   ro   rp   rq   rr   rs   rt   ru   rv   rw   rz   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   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?      s   

	
		r?   __main__)GZ
__future__r   r   r   r   r   r   r   Znumpyr%   Znumbar   r   Znumba.compilerr   r   r   r	   r
   Znumba.configr   r   r   Zsupportr   r   r   r   setrC   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   mainr   r   r   r   <module>   sr   
   r
