Uname:Linux mail.sarafai.ru 6.1.0-43-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.162-1 (2026-02-08) x86_64

403WebShell
403Webshell
Server IP : 82.148.16.210  /  Your IP : 216.73.216.19
Web Server : nginx/1.29.5
System : Linux mail.sarafai.ru 6.1.0-43-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.162-1 (2026-02-08) x86_64
User : root ( 0)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/local/lib/python3.12/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/lib/python3.12/test/test_math_property.py
import functools
import unittest
from math import isnan, nextafter
from test.support import requires_IEEE_754
from test.support.hypothesis_helper import hypothesis

floats = hypothesis.strategies.floats
integers = hypothesis.strategies.integers


def assert_equal_float(x, y):
    assert isnan(x) and isnan(y) or x == y


def via_reduce(x, y, steps):
    return functools.reduce(nextafter, [y] * steps, x)


class NextafterTests(unittest.TestCase):
    @requires_IEEE_754
    @hypothesis.given(
        x=floats(),
        y=floats(),
        steps=integers(min_value=0, max_value=2**16))
    def test_count(self, x, y, steps):
        assert_equal_float(via_reduce(x, y, steps),
                           nextafter(x, y, steps=steps))

    @requires_IEEE_754
    @hypothesis.given(
        x=floats(),
        y=floats(),
        a=integers(min_value=0),
        b=integers(min_value=0))
    def test_addition_commutes(self, x, y, a, b):
        first = nextafter(x, y, steps=a)
        second = nextafter(first, y, steps=b)
        combined = nextafter(x, y, steps=a+b)
        hypothesis.note(f"{first} -> {second} == {combined}")

        assert_equal_float(second, combined)

Youez - 2016 - github.com/yon3zu
LinuXploit