Skip to content

BUG: numpy.test() fails at test_linear_interpolation_formula_symmetric #22073

@GideonBear

Description

@GideonBear

Describe the issue:

When I run numpy.test() a failure is encountered in test_linear_interpolation_formula_symmetric. I don't know if this is actually a bug, but I thought I should add this as an issue. I've run the test twice now and it gives the same result.
I've searched for this on GitHub, Stack Overflow and Google, but got no results.
OS is Linux Mint 19.3 Cinnamon.

Reproduce the code example:

import numpy
numpy.test()

Error message:

============================================================================================== FAILURES ==============================================================================================
________________________________________________________________________ TestLerp.test_linear_interpolation_formula_symmetric ________________________________________________________________________

self = <numpy.lib.tests.test_function_base.TestLerp object at 0x7fe580065190>

    @hypothesis.given(t=st.floats(allow_nan=False, allow_infinity=False,
>                                 min_value=0, max_value=1),
                      a=st.floats(allow_nan=False, allow_infinity=False,
                                  min_value=-1e300, max_value=1e300),
                      b=st.floats(allow_nan=False, allow_infinity=False,
                                  min_value=-1e300, max_value=1e300))

f          = <function given.<locals>.run_test_as_given.<locals>.wrapped_test at 0x7fe5802cf790>
self       = <numpy.lib.tests.test_function_base.TestLerp object at 0x7fe580065190>

venv/lib/python3.8/site-packages/numpy/lib/tests/test_function_base.py:3568: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <numpy.lib.tests.test_function_base.TestLerp object at 0x7fe580065190>, t = 0.5, a = 0.2500000000000003, b = 1.0

    @hypothesis.given(t=st.floats(allow_nan=False, allow_infinity=False,
                                  min_value=0, max_value=1),
                      a=st.floats(allow_nan=False, allow_infinity=False,
                                  min_value=-1e300, max_value=1e300),
                      b=st.floats(allow_nan=False, allow_infinity=False,
                                  min_value=-1e300, max_value=1e300))
    def test_linear_interpolation_formula_symmetric(self, t, a, b):
        # double subtraction is needed to remove the extra precision of t < 0.5
        left = nfb._lerp(a, b, 1 - (1 - t))
        right = nfb._lerp(b, a, 1 - t)
>       assert left == right
E       assert 0.6250000000000001 == 0.6250000000000002

a          = 0.2500000000000003
b          = 1.0
left       = 0.6250000000000001
right      = 0.6250000000000002
self       = <numpy.lib.tests.test_function_base.TestLerp object at 0x7fe580065190>
t          = 0.5

venv/lib/python3.8/site-packages/numpy/lib/tests/test_function_base.py:3577: AssertionError
--------------------------------------------------------------------------------------------- Hypothesis ---------------------------------------------------------------------------------------------
Falsifying example: test_linear_interpolation_formula_symmetric(
    t=0.5,
    a=0.2500000000000003,
    b=1.0,
    self=<numpy.lib.tests.test_function_base.TestLerp at 0x7fe580065190>,
)

You can reproduce this example by temporarily adding @reproduce_failure('6.53.0', b'AXicY2BgOMAABwekGNAAIwAmtgGc') as a decorator on your test case

NumPy/Python version information:

1.23.1 3.8.0 (default, Dec 9 2021, 17:53:27)
[GCC 8.4.0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions