o
    ۾i                     @   s|   d dl Zd dlZd dlmZ d dlmZmZmZm	Z	 d dl
mZmZ dd Zdd ZG d	d
 d
eZedkr<e  dS dS )    N)cuda)float32float64int32void)unittestCUDATestCasec                 C   s   t |\| d< |d< d S Nr   )mathfrexp)aryxaryexparg r   \/home/ubuntu/.local/lib/python3.10/site-packages/numba/cuda/tests/cudapy/test_frexp_ldexp.pysimple_frexp   s   r   c                 C   s   t ||| d< d S r	   )r
   ldexp)r   r   expr   r   r   simple_ldexp   s   r   c                   @   s<   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd ZdS )TestCudaFrexpLdexpc                 C   s   t t|d d  td d  |t}d}tjd|d}tjdtjd}|d ||| tj||d | 	|d tj
}|d ||| tj||tj
 | 	|d tj}|d ||| tj||tj | 	|d d S )No!	@   dtyper   r   o!?   r   )r   jitr   r   r   npzerostestingassert_array_equalassertEqualinfnan)selfnptypenbtypecompiledr   r   r   r   r   r   template_test_frexp   s   &z&TestCudaFrexpLdexp.template_test_frexpc                 C   s   t t|d d  |tt}d}d}tjd|d}|d ||| tj||d tj	}|d ||| tj||tj	 tj
}|d ||| tj||tj
 d S )Nr   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   template_test_ldexp$   s   z&TestCudaFrexpLdexp.template_test_ldexpc                 C      |  tjt d S N)r)   r   r   r%   r   r   r   test_frexp_f44      z TestCudaFrexpLdexp.test_frexp_f4c                 C   r+   r,   )r*   r   r   r-   r   r   r   test_ldexp_f47   r/   z TestCudaFrexpLdexp.test_ldexp_f4c                 C   r+   r,   )r)   r   r   r-   r   r   r   test_frexp_f8:   r/   z TestCudaFrexpLdexp.test_frexp_f8c                 C   r+   r,   )r*   r   r   r-   r   r   r   test_ldexp_f8=   r/   z TestCudaFrexpLdexp.test_ldexp_f8N)	__name__
__module____qualname__r)   r*   r.   r0   r1   r2   r   r   r   r   r      s    r   __main__)numpyr   r
   numbar   numba.typesr   r   r   r   numba.cuda.testingr   r   r   r   r   r3   mainr   r   r   r   <module>   s    1