| Server IP : 118.27.122.248 / Your IP : 216.73.217.130 Web Server : Apache System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64 User : c9415830 ( 11735) PHP Version : 8.4.17 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/alt/python36/lib64/python3.6/test/__pycache__/ |
Upload File : |
3
�w2_[� � @ sp d dl mZmZmZ d dlmZ d dlZd dlZd dlZd dl Z d dl
Z
d dlZd dlZdZ
ed�Zed�Zed�ZejjZd*\ZZee d+kZedkr�ejd ZneZejje�p�ejZejj ed�Z!ejj ed
�Z"dd� Z#dd� Z$dd� Z%dd� Z&dd� Z'dd� Z(dd� Z)dd� Z*d,d d!�Z+G d"d#� d#e,�Z-G d$d%� d%ej.�Z/G d&d'� d'ej.�Z0d(d)� Z1edk�rle1� dS )-� )�run_unittest�verbose�requires_IEEE_754)�supportNg�h㈵��>�nan�infz-inf� ��7y�AC��):��@� �__main__zmath_testcases.txtzcmath_testcases.txtc C s. t jdt jd| ��d }|dk r*|d }|S )a� Convert 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 native doubles are represented in IEEE 754 binary64 format.
Note: 0.0 and -0.0 are converted to 0 and -1, respectively.
z<qz<dr � �? l )�struct�unpack�pack)�x�n� r �3/opt/alt/python36/lib64/python3.6/test/test_math.py�to_ulps# s
r c C s� t t| ��} tj| �s tj| �r$| S tjdtjd| ��d }tjdtjd|d ��d }tj|�r�tjdtjd|d ��d }| | S || S dS )a� Return the value of the least significant bit of a
float x, such that the first float bigger than x is x+ulp(x).
Then, given an expected result x and a tolerance of n ulps,
the result y should be such that abs(y-x) <= n * ulp(x).
The results from this function will only make sense on platforms
where native doubles are represented in IEEE 754 binary64 format.
z<qz<dr � N)�abs�float�math�isnan�isinfr r r )r r Zx_nextZx_prevr r r �ulp4 s
r c C s | rdt | | d @ � S dS )zANumber of '1' bits in binary expansion of a nonnnegative integer.r r )�count_set_bits)r r r r r a s r c C sD || d? }|sdS |dkr | S | | dB }t | |�t ||� S dS )z�Product of integers in range(start, stop, 2), computed recursively.
start and stop should both be odd, with start <= stop.
r N)�partial_product)�start�stopZ
numfactorsZmidr r r r e s r c C sd d }}xJt t| j� ��D ]6}|t| |d ? d dB | |? d dB �9 }||9 }qW || t| � >