8000 Issue printing `longdouble` on Linux aarch64 with the Meson build · Issue #23974 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Issue printing longdouble on Linux aarch64 with the Meson build #23974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rgommers opened this issue Jun 18, 2023 · 1 comment · Fixed by #23985
Closed

Issue printing longdouble on Linux aarch64 with the Meson build #23974

rgommers opened this issue Jun 18, 2023 · 1 comment · Fixed by #23985
Labels

Comments

@rgommers
Copy link
Member

Observed in the cibuildwheel tests in #23838 (comment)

FAILED tests/test_arrayprint.py::TestComplexArray::test_str - AssertionError: 
FAILED tests/test_longdouble.py::test_repr_roundtrip - AssertionError: 
FAILED tests/test_print.py::test_float_types[longdouble] - AssertionError: 
FAILED tests/test_print.py::test_nan_inf_float[longdouble] - AssertionError: 
FAILED tests/test_print.py::test_complex_types[clongdouble] - AssertionError: 
FAILED tests/test_print.py::test_complex_inf_nan[clongdouble] - AssertionError: 
FAILED tests/test_print.py::test_float_type_print[longdouble] - AssertionError: 
FAILED tests/test_print.py::test_complex_type_print[clongdouble] - AssertionE...
FAILED tests/test_scalarprint.py::TestRealScalars::test_str - AssertionError: 
FAILED tests/test_scalarprint.py::TestRealScalars::test_dragon4_interface - A...
FAILED tests/test_strings.py::test_float_to_string_cast[g-S] - AssertionError: 
FAILED tests/test_strings.py::test_float_to_string_cast[g-U] - AssertionError: 
12 failed, 19555 passed, 851 skipped, 17 xfailed, 3 xpassed, 20 warnings in 220.84s (0:03:40)

Full tracebacks:

__________________________ TestComplexArray.test_str ___________________________
self = <numpy.core.tests.test_arrayprint.TestComplexArray object at 0xffff578683d0>
    def test_str(self):
        rvals = [0, 1, -1, np.inf, -np.inf, np.nan]
        cvals = [complex(rp, ip) for rp in rvals for ip in rvals]
        dtypes = [np.complex64, np.cdouble, np.clongdouble]
        actual = [str(np.array([c], dt)) for c in cvals for dt in dtypes]
        wanted = [
            '[0.+0.j]',    '[0.+0.j]',    '[0.+0.j]',
            '[0.+1.j]',    '[0.+1.j]',    '[0.+1.j]',
            '[0.-1.j]',    '[0.-1.j]',    '[0.-1.j]',
            '[0.+infj]',   '[0.+infj]',   '[0.+infj]',
            '[0.-infj]',   '[0.-infj]',   '[0.-infj]',
            '[0.+nanj]',   '[0.+nanj]',   '[0.+nanj]',
            '[1.+0.j]',    '[1.+0.j]',    '[1.+0.j]',
            '[1.+1.j]',    '[1.+1.j]',    '[1.+1.j]',
            '[1.-1.j]',    '[1.-1.j]',    '[1.-1.j]',
            '[1.+infj]',   '[1.+infj]',   '[1.+infj]',
            '[1.-infj]',   '[1.-infj]',   '[1.-infj]',
            '[1.+nanj]',   '[1.+nanj]',   '[1.+nanj]',
            '[-1.+0.j]',   '[-1.+0.j]',   '[-1.+0.j]',
            '[-1.+1.j]',   '[-1.+1.j]',   '[-1.+1.j]',
            '[-1.-1.j]',   '[-1.-1.j]',   '[-1.-1.j]',
            '[-1.+infj]',  '[-1.+infj]',  '[-1.+infj]',
            '[-1.-infj]',  '[-1.-infj]',  '[-1.-infj]',
            '[-1.+nanj]',  '[-1.+nanj]',  '[-1.+nanj]',
            '[inf+0.j]',   '[inf+0.j]',   '[inf+0.j]',
            '[inf+1.j]',   '[inf+1.j]',   '[inf+1.j]',
            '[inf-1.j]',   '[inf-1.j]',   '[inf-1.j]',
            '[inf+infj]',  '[inf+infj]',  '[inf+infj]',
            '[inf-infj]',  '[inf-infj]',  '[inf-infj]',
            '[inf+nanj]',  '[inf+nanj]',  '[inf+nanj]',
            '[-inf+0.j]',  '[-inf+0.j]',  '[-inf+0.j]',
            '[-inf+1.j]',  '[-inf+1.j]',  '[-inf+1.j]',
            '[-inf-1.j]',  '[-inf-1.j]',  '[-inf-1.j]',
            '[-inf+infj]', '[-inf+infj]', '[-inf+infj]',
            '[-inf-infj]', '[-inf-infj]', '[-inf-infj]',
            '[-inf+nanj]', '[-inf+nanj]', '[-inf+nanj]',
            '[nan+0.j]',   '[nan+0.j]',   '[nan+0.j]',
            '[nan+1.j]',   '[nan+1.j]',   '[nan+1.j]',
            '[nan-1.j]',   '[nan-1.j]',   '[nan-1.j]',
            '[nan+infj]',  '[nan+infj]',  '[nan+infj]',
            '[nan-infj]',  '[nan-infj]',  '[nan-infj]',
            '[nan+nanj]',  '[nan+nanj]',  '[nan+nanj]']
    
        for res, val in zip(actual, wanted):
>           assert_equal(res, val)
E           AssertionError: 
E           Items are not equal:
E            ACTUAL: '[0.+0.j]'
E            DESIRED: '[0.+1.j]'
actual     = ['[0.+0.j]', '[0.+0.j]', '[0.+0.j]', '[0.+1.j]', '[0.+1.j]', '[0.+0.j]', ...]
cvals      = [0j, 1j, -1j, infj, -infj, nanj, ...]
dtypes     = [<class 'numpy.complex64'>, <class 'numpy.complex128'>, <class 'numpy.clongdouble'>]
res        = '[0.+0.j]'
rvals      = [0, 1, -1, inf, -inf, nan]
self       = <numpy.core.tests.test_arrayprint.TestComplexArray object at 0xffff578683d0>
val        = '[0.+1.j]'
wanted     = ['[0.+0.j]', '[0.+0.j]', '[0.+0.j]', '[0.+1.j]', '[0.+1.j]', '[0.+1.j]', ...]
../venv/lib/python3.11/site-packages/numpy/core/tests/test_arrayprint.py:208: AssertionError
_____________________________ test_repr_roundtrip ______________________________
    @pytest.mark.skipif(IS_MUSL,
                        reason="test flaky on musllinux")
    @pytest.mark.skipif(LD_INFO.precision + 2 >= repr_precision,
                        reason="repr precision not enough to show eps")
    def test_repr_roundtrip():
        # We will only see eps in repr if within printing precision.
        o = 1 + LD_INFO.eps
>       assert_equal(np.longdouble(repr(o)), o, "repr was %s" % repr(o))
E       AssertionError: 
E       Items are not equal:
E       repr was 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004
E        ACTUAL: 2.25179981368525e-4936
E        DESIRED: 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004
o          = 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004
../venv/lib/python3.11/site-packages/numpy/core/tests/test_longdouble.py:43: AssertionError
_________________________ test_float_types[longdouble] _________________________
tp = <class 'numpy.longdouble'>
    @pytest.mark.parametrize('tp', [np.float32, np.double, np.longdouble])
    def test_float_types(tp):
        """ Check formatting.
    
            This is only for the str function, and only for simple types.
            The precision of np.float32 and np.longdouble aren't the same as the
            python float precision.
    
        """
        for x in [0, 1, -1, 1e20]:
>           assert_equal(str(tp(x)), str(float(x)),
                         err_msg='Failed str formatting for type %s' % tp)
E           AssertionError: 
E           Items are not equal: Failed str formatting for type <class 'numpy.longdouble'>
E            ACTUAL: '0.0'
E            DESIRED: '1.0'
tp         = <class 'numpy.longdouble'>
x          = 1
../venv/lib/python3.11/site-packages/numpy/core/tests/test_print.py:25: AssertionError
________________________ test_nan_inf_float[longdouble] ________________________
tp = <class 'numpy.longdouble'>
    @pytest.mark.parametrize('tp', [np.float32, np.double, np.longdouble])
    def test_nan_inf_float(tp):
        """ Check formatting of nan & inf.
    
            This is only for the str function, and only for simple types.
            The precision of np.float32 and np.longdouble aren't the same as the
            python float precision.
    
        """
        for x in [np.inf, -np.inf, np.nan]:
>           assert_equal(str(tp(x)), _REF[x],
                         err_msg='Failed str formatting for type %s' % tp)
E           AssertionError: 
E           Items are not equal: Failed str formatting for type <class 'numpy.longdouble'>
E            ACTUAL: '0e+00'
E            DESIRED: 'inf'
tp         = <class 'numpy.longdouble'>
x          = inf
../venv/lib/python3.11/site-packages/numpy/core/tests/test_print.py:47: AssertionError
_______________________ test_complex_types[clongdouble] ________________________
tp = <class 'numpy.clongdouble'>
    @pytest.mark.parametrize('tp', [np.complex64, np.cdouble, np.clongdouble])
    def test_complex_types(tp):
        """Check formatting of complex types.
    
            This is only for the str function, and only for simple types.
            The precision of np.float32 and np.longdouble aren't the same as the
            python float precision.
    
        """
        for x in [0, 1, -1, 1e20]:
>           assert_equal(str(tp(x)), str(complex(x)),
                         err_msg='Failed str formatting for type %s' % tp)
E           AssertionError: 
E           Items are not equal: Failed str formatting for type <class 'numpy.clongdouble'>
E            ACTUAL: '(0+0j)'
E            DESIRED: '(1+0j)'
tp         = <class 'numpy.clongdouble'>
x          = 1
../venv/lib/python3.11/site-packages/numpy/core/tests/test_print.py:61: AssertionError
______________________ test_complex_inf_nan[clongdouble] _______________________
dtype = <class 'numpy.clongdouble'>
    @pytest.mark.parametrize('dtype', [np.complex64, np.cdouble, np.clongdouble])
    def test_complex_inf_nan(dtype):
        """Check inf/nan formatting of complex types."""
        TESTS = {
            complex(np.inf, 0): "(inf+0j)",
            complex(0, np.inf): "infj",
            complex(-np.inf, 0): "(-inf+0j)",
            complex(0, -np.inf): "-infj",
            complex(np.inf, 1): "(inf+1j)",
            complex(1, np.inf): "(1+infj)",
            complex(-np.inf, 1): "(-inf+1j)",
            complex(1, -np.inf): "(1-infj)",
            complex(np.nan, 0): "(nan+0j)",
            complex(0, np.nan): "nanj",
            complex(-np.nan, 0): "(nan+0j)",
            complex(0, -np.nan): "nanj",
            complex(np.nan, 1): "(nan+1j)",
            complex(1, np.nan): "(1+nanj)",
            complex(-np.nan, 1): "(nan+1j)",
            complex(1, -np.nan): "(1+nanj)",
        }
        for c, s in TESTS.items():
>           assert_equal(str(dtype(c)), s)
E           AssertionError: 
E           Items are not equal:
E            ACTUAL: '0e+00j'
E            DESIRED: 'infj'
TESTS      = {(inf+0j): '(inf+0j)', infj: 'infj', (-inf+0j): '(-inf+0j)', -infj: '-infj', ...}
c          = infj
dtype      = <class 'numpy.clongdouble'>
s          = 'infj'
../venv/lib/python3.11/site-packages/numpy/core/tests/test_print.py:99: AssertionError
______________________ test_float_type_print[longdouble] _______________________
tp = <class 'numpy.longdouble'>
    @pytest.mark.parametrize('tp', [np.float32, np.double, np.longdouble])
    def test_float_type_print(tp):
        """Check formatting when using print """
        for x in [0, 1, -1, 1e20]:
>           _test_redirected_print(float(x), tp)
tp         = <class 'numpy.longdouble'>
x          = 1
../venv/lib/python3.11/site-packages/numpy/core/tests/test_print.py:126: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
x = 1.0, tp = <class 'numpy.longdouble'>, ref = None
    def _test_redirected_print(x, tp, ref=None):
        file = StringIO()
        file_tp = StringIO()
        stdout = sys.stdout
        try:
            sys.stdout = file_tp
            print(tp(x))
            sys.stdout = file
            if ref:
                print(ref)
            else:
                print(x)
        finally:
            sys.stdout = stdout
    
>       assert_equal(file.getvalue(), file_tp.getvalue(),
                     err_msg='print failed for type%s' % tp)
E       AssertionError: 
E       Items are not equal: print failed for type<class 'numpy.longdouble'>
E        ACTUAL: '1.0\n'
E        DESIRED: '0.0\n'
file       = <_io.StringIO object at 0xffff545b1c60>
file_tp    = <_io.StringIO object at 0xffff545b2b00>
ref        = None
stdout     = <_io.TextIOWrapper name="<_io.FileIO name=14 mode='rb+' closefd=True>" mode='r+' encoding='utf-8'>
tp         = <class 'numpy.longdouble'>
x          = 1.0
../venv/lib/python3.11/site-packages/numpy/core/tests/test_print.py:118: AssertionError
_____________________ test_complex_type_print[clongdouble] _____________________
tp = <class 'numpy.clongdouble'>
    @pytest.mark.parametrize('tp', [np.complex64, np.cdouble, np.clongdouble])
    def test_complex_type_print(tp):
        """Check formatting when using print """
        # We do not create complex with inf/nan directly because the feature is
        # missing in python < 2.6
        for x in [0, 1, -1, 1e20]:
>           _test_redirected_print(complex(x), tp)
tp         = <class 'numpy.clongdouble'>
x          = 1
../venv/lib/python3.11/site-packages/numpy/core/tests/test_print.py:144: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
x = (1+0j), tp = <class 'numpy.clongdouble'>, ref = None
    def _test_redirected_print(x, tp, ref=None):
        file = StringIO()
        file_tp = StringIO()
        stdout = sys.stdout
        try:
            sys.stdout = file_tp
            print(tp(x))
            sys.stdout = file
            if ref:
                print(ref)
            else:
                print(x)
        finally:
            sys.stdout = stdout
    
>       assert_equal(file.getvalue(), file_tp.getvalue(),
                     err_msg='print failed for type%s' % tp)
E       AssertionError: 
E       Items are not equal: print failed for type<class 'numpy.clongdouble'>
E        ACTUAL: '(1+0j)\n'
E        DESIRED: '(0+0j)\n'
file       = <_io.StringIO object at 0xffff545b2cb0>
file_tp    = <_io.StringIO object at 0xffff545b2d40>
ref        = None
stdout     = <_io.TextIOWrapper name="<_io.FileIO name=14 mode='rb+' closefd=True>" mode='r+' encoding='utf-8'>
tp         = <class 'numpy.clongdouble'>
x          = (1+0j)
../venv/lib/python3.11/site-packages/numpy/core/tests/test_print.py:118: AssertionError
___________________________ TestRealScalars.test_str ___________________________
self = <numpy.core.tests.test_scalarprint.TestRealScalars object at 0xffff4f4a1150>
    def test_str(self):
        svals = [0.0, -0.0, 1, -1, np.inf, -np.inf, np.nan]
        styps = [np.float16, np.float32, np.float64, np.longdouble]
        wanted = [
             ['0.0',  '0.0',  '0.0',  '0.0' ],
             ['-0.0', '-0.0', '-0.0', '-0.0'],
             ['1.0',  '1.0',  '1.0',  '1.0' ],
             ['-1.0', '-1.0', '-1.0', '-1.0'],
             ['inf',  'inf',  'inf',  'inf' ],
             ['-inf', '-inf', '-inf', '-inf'],
             ['nan',  'nan',  'nan',  'nan']]
    
        for wants, val in zip(wanted, svals):
            for want, styp in zip(wants, styps):
                msg = 'for str({}({}))'.format(np.dtype(styp).name, repr(val))
>               assert_equal(str(styp(val)), want, err_msg=msg)
E               AssertionError: 
E               Items are not equal: for str(float128(-0.0))
E                ACTUAL: '0.0'
E                DESIRED: '-0.0'
msg        = 'for str(float128(-0.0))'
self       = <numpy.core.tests.test_scalarprint.TestRealScalars object at 0xffff4f4a1150>
styp       = <class 'numpy.longdouble'>
styps      = [<class 'numpy.float16'>, <class 'numpy.float32'>, <class 'numpy.float64'>, <class 'numpy.longdouble'>]
svals      = [0.0, -0.0, 1, -1, inf, -inf, ...]
val        = -0.0
want       = '-0.0'
wanted     = [['0.0', '0.0', '0.0', '0.0'], ['-0.0', '-0.0', '-0.0', '-0.0'], ['1.0', '1.0', '1.0', '1.0'], ['-1.0', '-1.0', '-1.0', '-1.0'], ['inf', 'inf', 'inf', 'inf'], ['-inf', '-inf', '-inf', '-inf'], ...]
wants      = ['-0.0', '-0.0', '-0.0', '-0.0']
../venv/lib/python3.11/site-packages/numpy/core/tests/test_scalarprint.py:29: AssertionError
____________________ TestRealScalars.test_dragon4_interface ____________________
self = <numpy.core.tests.test_scalarprint.TestRealScalars object at 0xffff54dde810>
    def test_dragon4_interface(self):
        tps = [np.float16, np.float32, np.float64]
        # test is flaky for musllinux on np.float128
        if hasattr(np, 'float128') and not IS_MUSL:
            tps.append(np.float128)
    
        fpos = np.format_float_positional
        fsci = np.format_float_scientific
    
        for tp in tps:
            # test padding
>           assert_equal(fpos(tp('1.0'), pad_left=4, pad_right=4), "   1.    ")
E           AssertionError: 
E           Items are not equal:
E            ACTUAL: '   0.    '
E            DESIRED: '   1.    '
fpos       = <function format_float_positional at 0xffff89575260>
fsci       = <function format_float_scientific at 0xffff895751c0>
self       = <numpy.core.tests.test_scalarprint.TestRealScalars object at 0xffff54dde810>
tp         = <class 'numpy.longdouble'>
tps        = [<class 'numpy.float16'>, <class 'numpy.float32'>, <class 'numpy.float64'>, <class 'numpy.longdouble'>]
../venv/lib/python3.11/site-packages/numpy/core/tests/test_scalarprint.py:274: AssertionError
________________________ test_float_to_string_cast[g-S] ________________________
str_dt = 'S', float_dt = dtype('float128')
    @pytest.mark.parametrize("str_dt", ["S", "U"])
    @pytest.mark.parametrize("float_dt", np.typecodes["AllFloat"])
    def test_float_to_string_cast(str_dt, float_dt):
        float_dt = np.dtype(float_dt)
        fi = np.finfo(float_dt)
        arr = np.array([np.nan, np.inf, -np.inf, fi.max, fi.min], dtype=float_dt)
        expected = ["nan", "inf", "-inf", repr(fi.max), repr(fi.min)]
        if float_dt.kind == 'c':
            expected = [f"({r}+0j)" for r in expected]
    
        res = arr.astype(str_dt)
>       assert_array_equal(res, np.array(expected, dtype=str_dt))
arr        = <[ValueError('not enough values to unpack (expected 2, got 1)') raised in repr()] ndarray object at 0xffff4fd91dd0>
expected   = ['nan', 'inf', '-inf', 'nan', 'nan']
fi         = finfo(resolution=-1.7515355235394798696e-2315, min=-nan, max=nan, dtype=float128)
float_dt   = dtype('float128')
res        = array([b'0.0', b'0e+00', b'0e+00', b'nan', b'nan'], dtype='|S48')
str_dt     = 'S'
../venv/lib/python3.11/site-packages/numpy/core/tests/test_strings.py:99: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
args = (<built-in function eq>, array([b'0.0', b'0e+00', b'0e+00', b'nan', b'nan'], dtype='|S48'), array([b'nan', b'inf', b'-inf', b'nan', b'nan'], dtype='|S4'))
kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True}
    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Arrays are not equal
E           
E           Mismatched elements: 3 / 5 (60%)
E            x: array([b'0.0', b'0e+00', b'0e+00', b'nan', b'nan'], dtype='|S48')
E            y: array([b'nan', b'inf', b'-inf', b'nan', b'nan'], dtype='|S4')
args       = (<built-in function eq>, array([b'0.0', b'0e+00', b'0e+00', b'nan', b'nan'], dtype='|S48'), array([b'nan', b'inf', b'-inf', b'nan', b'nan'], dtype='|S4'))
func       = <function assert_array_compare at 0xffff87352160>
kwds       = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True}
self       = <contextlib._GeneratorContextManager object at 0xffff8740f4d0>
/opt/python/cp311-cp311/lib/python3.11/contextlib.py:81: AssertionError
________________________ test_float_to_string_cast[g-U] ________________________
str_dt = 'U', float_dt = dtype('float128')
    @pytest.mark.parametrize("str_dt", ["S", "U"])
    @pytest.mark.parametrize("float_dt", np.typecodes["AllFloat"])
    def test_float_to_string_cast(str_dt, float_dt):
        float_dt = np.dtype(float_dt)
        fi = np.finfo(float_dt)
        arr = np.array([np.nan, np.inf, -np.inf, fi.max, fi.min], dtype=float_dt)
        expected = ["nan", "inf", "-inf", repr(fi.max), repr(fi.min)]
        if float_dt.kind == 'c':
            expected = [f"({r}+0j)" for r in expected]
    
        res = arr.astype(str_dt)
>       assert_array_equal(res, np.array(expected, dtype=str_dt))
arr        = <[ValueError('not enough values to unpack (expected 2, got 1)') raised in repr()] ndarray object at 0xffff4f372c70>
expected   = ['nan', 'inf', '-inf', 'nan', 'nan']
fi         = finfo(resolution=-1.7515355235394798696e-2315, min=-nan, max=nan, dtype=float128)
float_dt   = dtype('float128')
res        = array(['0.0', '0e+00', '0e+00', 'nan', 'nan'], dtype='<U48')
str_dt     = 'U'
../venv/lib/python3.11/site-packages/numpy/core/tests/test_strings.py:99: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
args = (<built-in function eq>, array(['0.0', '0e+00', '0e+00', 'nan', 'nan'], dtype='<U48'), array(['nan', 'inf', '-inf', 'nan', 'nan'], dtype='<U4'))
kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True}
    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Arrays are not equal
E           
E 
8000
          Mismatched elements: 3 / 5 (60%)
E            x: array(['0.0', '0e+00', '0e+00', 'nan', 'nan'], dtype='<U48')
E            y: array(['nan', 'inf', '-inf', 'nan', 'nan'], dtype='<U4')
args       = (<built-in function eq>, array(['0.0', '0e+00', '0e+00', 'nan', 'nan'], dtype='<U48'), array(['nan', 'inf', '-inf', 'nan', 'nan'], dtype='<U4'))
func       = <function assert_array_compare at 0xffff87352160>
kwds       = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True}
self       = <contextlib._GeneratorContextManager object at 0xffff8740f4d0>
/opt/python/cp311-cp311/lib/python3.11/contextlib.py:81: AssertionError
=============================== warnings summary ===============================
tests/test_longdouble.py::test_repr_roundtrip
  /tmp/tmp.h2Hz2Ci5ir/venv/lib/python3.11/site-packages/numpy/core/tests/test_longdouble.py:43: RuntimeWarning: overflow encountered in conversion from string
    assert_equal(np.longdouble(repr(o)), o, "repr was %s" % repr(o))
tests/test_numeric.py::TestNonarrayArgs::test_dunder_round_edgecases[2147483647--1]
  /tmp/tmp.h2Hz2Ci5ir/venv/lib/python3.11/site-packages/numpy/core/tests/test_numeric.py:200: RuntimeWarning: invalid value encountered in cast
    assert_equal(round(val, ndigits), round(np.int32(val), ndigits))
tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
  /tmp/tmp.h2Hz2Ci5ir/venv/lib/python3.11/site-packages/numpy/core/tests/test_umath.py:1935: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
    x_f64 = np.float64(x_f32)
tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
  /tmp/tmp.h2Hz2Ci5ir/venv/lib/python3.11/site-packages/numpy/core/tests/test_umath.py:1944: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
    assert_array_max_ulp(myfunc(x_f64), np.float64(y_true128),
tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc
  /tmp/tmp.h2Hz2Ci5ir/venv/lib/python3.11/site-packages/numpy/core/tests/test_umath.py:1940: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
    assert_equal(myfunc(x_f64), np.float64(y_true128))
tests/test_umath.py::TestComplexFunctions::test_loss_of_precision[complex64]
tests/test_umath.py::TestComplexFunctions::test_loss_of_precision[complex128]
  /tmp/tmp.h2Hz2Ci5ir/venv/lib/python3.11/site-packages/numpy/core/tests/test_umath.py:4184: RuntimeWarning: divide by zero encountered in divide
    d = np.absolute(np.arcsinh(x)/np.arcsinh(z).real - 1)
-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================== short test summary info ============================
FAILED tests/test_arrayprint.py::TestComplexArray::test_str - AssertionError: 
FAILED tests/test_longdouble.py::test_repr_roundtrip - AssertionError: 
FAILED tests/test_print.py::test_float_types[longdouble] - AssertionError: 
FAILED tests/test_print.py::test_nan_inf_float[longdouble] - AssertionError: 
FAILED tests/test_print.py::test_complex_types[clongdouble] - AssertionError: 
FAILED tests/test_print.py::test_complex_inf_nan[clongdouble] - AssertionError: 
FAILED tests/test_print.py::test_float_type_print[longdouble] - AssertionError: 
FAILED tests/test_print.py::test_complex_type_print[clongdouble] - AssertionE...
FAILED tests/test_scalarprint.py::TestRealScalars::test_str - AssertionError: 
FAILED tests/test_scalarprint.py::TestRealScalars::test_dragon4_interface - A...
FAILED tests/test_strings.py::test_float_to_string_cast[g-S] - AssertionError: 
FAILED tests/test_strings.py::test_float_to_string_cast[g-U] - AssertionError: 
12 failed, 19555 passed, 851 skipped, 17 xfailed, 3 xpassed, 20 warnings in 220.84s (0:03:40)
_________________________ test_float_types[longdouble] _________________________
tp = <class 'numpy.longdouble'>
    @pytest.mark.parametrize('tp', [np.float32, np.double, np.longdouble])
    def test_float_types(tp):
        """ Check formatting.
    
            This is only for the str function, and only for simple types.
            The precision of np.float32 and np.longdouble aren't the same as the
            python float precision.
    
        """
        for x in [0, 1, -1, 1e20]:
>           assert_equal(str(tp(x)), str(float(x)),
                         err_msg='Failed str formatting for type %s' % tp)
E           AssertionError: 
E           Items are not equal: Failed str formatting for type <class 'numpy.longdouble'>
E            ACTUAL: '0.0'
E            DESIRED: '1.0'
tp         = <class 'numpy.longdouble'>
x          = 1
../venv/lib/python3.11/site-packages/numpy/core/tests/test_print.py:25: AssertionError
________________________ test_nan_inf_float[longdouble] ________________________
tp = <class 'numpy.longdouble'>
    @pytest.mark.parametrize('tp', [np.float32, np.double, np.longdouble])
    def test_nan_inf_float(tp):
        """ Check formatting of nan & inf.
    
            This is only for the str function, and only for simple types.
            The precision of np.float32 and np.longdouble aren't the same as the
            python float precision.
    
        """
        for x in [np.inf, -np.inf, np.nan]:
>           assert_equal(str(tp(x)), _REF[x],
                         err_msg='Failed str formatting for type %s' % tp)
E           AssertionError: 
E           Items are not equal: Failed str formatting for type <class 'numpy.longdouble'>
E            ACTUAL: '0e+00'
E            DESIRED: 'inf'
tp         = <class 'numpy.longdouble'>
x          = inf
../venv/lib/python3.11/site-packages/numpy/core/tests/test_print.py:47: AssertionError
_______________________ test_complex_types[clongdouble] ________________________
tp = <class 'numpy.clongdouble'>
    @pytest.mark.parametrize('tp', [np.complex64, np.cdouble, np.clongdouble])
    def test_complex_types(tp):
        """Check formatting of complex types.
    
            This is only for the str function, and only for simple types.
            The precision of np.float32 and np.longdouble aren't the same as the
            python float precision.
    
        """
        for x in [0, 1, -1, 1e20]:
>           assert_equal(str(tp(x)), str(complex(x)),
                         err_msg='Failed str formatting for type %s' % tp)
E           AssertionError: 
E           Items are not equal: Failed str formatting for type <class 'numpy.clongdouble'>
E            ACTUAL: '(0+0j)'
E            DESIRED: '(1+0j)'
tp         = <class 'numpy.clongdouble'>
x          = 1
../venv/lib/python3.11/site-packages/numpy/core/tests/test_print.py:61: AssertionError
______________________ test_complex_inf_nan[clongdouble] _______________________
dtype = <class 'numpy.clongdouble'>
    @pytest.mark.parametrize('dtype', [np.complex64, np.cdouble, np.clongdouble])
    def test_complex_inf_nan(dtype):
        """Check inf/nan formatting of complex types."""
        TESTS = {
            complex(np.inf, 0): "(inf+0j)",
            complex(0, np.inf): "infj",
            complex(-np.inf, 0): "(-inf+0j)",
            complex(0, -np.inf): "-infj",
            complex(np.inf, 1): "(inf+1j)",
            complex(1, np.inf): "(1+infj)",
            complex(-np.inf, 1): "(-inf+1j)",
            complex(1, -np.inf): "(1-infj)",
            complex(np.nan, 0): "(nan+0j)",
            complex(0, np.nan): "nanj",
            complex(-np.nan, 0): "(nan+0j)",
            complex(0, -np.nan): "nanj",
            complex(np.nan, 1): "(nan+1j)",
            complex(1, np.nan): "(1+nanj)",
            complex(-np.nan, 1): "(nan+1j)",
            complex(1, -np.nan): "(1+nanj)",
        }
        for c, s in TESTS.items():
>           assert_equal(str(dtype(c)), s)
E           AssertionError: 
E           Items are not equal:
E            ACTUAL: '0e+00j'
E            DESIRED: 'infj'
TESTS      = {(inf+0j): '(inf+0j)', infj: 'infj', (-inf+0j): '(-inf+0j)', -infj: '-infj', ...}
c          = infj
dtype      = <class 'numpy.clongdouble'>
s          = 'infj'
../venv/lib/python3.11/site-packages/numpy/core/tests/test_print.py:99: AssertionError
______________________ test_float_type_print[longdouble] _______________________
tp = <class 'numpy.longdouble'>
    @pytest.mark.parametrize('tp', [np.float32, np.double, np.longdouble])
    def test_float_type_print(tp):
        """Check formatting when using print """
        for x in [0, 1, -1, 1e20]:
>           _test_redirected_print(float(x), tp)
tp         = <class 'numpy.longdouble'>
x          = 1
../venv/lib/python3.11/site-packages/numpy/core/tests/test_print.py:126: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
x = 1.0, tp = <class 'numpy.longdouble'>, ref = None
    def _test_redirected_print(x, tp, ref=None):
        file = StringIO()
        file_tp = StringIO()
        stdout = sys.stdout
        try:
            sys.stdout = file_tp
            print(tp(x))
            sys.stdout = file
            if ref:
                print(ref)
            else:
                print(x)
        finally:
            sys.stdout = stdout
    
>       assert_equal(file.getvalue(), file_tp.getvalue(),
                     err_msg='print failed for type%s' % tp)
E       AssertionError: 
E       Items are not equal: print failed for type<class 'numpy.longdouble'>
E        ACTUAL: '1.0\n'
E        DESIRED: '0.0\n'
file       = <_io.StringIO object at 0xffff4f3b3f40>
file_tp    = <_io.StringIO object at 0xffff4f3b3d90>
ref        = None
stdout     = <_io.TextIOWrapper name="<_io.FileIO name=6 mode='rb+' closefd=True>" mode='r+' encoding='utf-8'>
tp         = <class 'numpy.longdouble'>
x          = 1.0
../venv/lib/python3.11/site-packages/numpy/core/tests/test_print.py:118: AssertionError
_____________________ test_complex_type_print[clongdouble] _____________________
tp = <class 'numpy.clongdouble'>
    @pytest.mark.parametrize('tp', [np.complex64, np.cdouble, np.clongdouble])
    def test_complex_type_print(tp):
        """Check formatting when using print """
        # We do not create complex with inf/nan directly because the feature is
        # missing in python < 2.6
        for x in [0, 1, -1, 1e20]:
>           _test_redirected_print(complex(x), tp)
tp         = <class 'numpy.clongdouble'>
x          = 1
../venv/lib/python3.11/site-packages/numpy/core/tests/test_print.py:144: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
x = (1+0j), tp = <class 'numpy.clongdouble'>, ref = None
    def _test_redirected_print(x, tp, ref=None):
        file = StringIO()
        file_tp = StringIO()
        stdout = sys.stdout
        try:
            sys.stdout = file_tp
            print(tp(x))
            sys.stdout = file
            if ref:
                print(ref)
            else:
                print(x)
        finally:
            sys.stdout = stdout
    
>       assert_equal(file.getvalue(), file_tp.getvalue(),
                     err_msg='print failed for type%s' % tp)
E       AssertionError: 
E       Items are not equal: print failed for type<class 'numpy.clongdouble'>
E        ACTUAL: '(1+0j)\n'
E        DESIRED: '(0+0j)\n'
file       = <_io.StringIO object at 0xffff4f3b3910>
file_tp    = <_io.StringIO object at 0xffff4f3b39a0>
ref        = None
stdout     = <_io.TextIOWrapper name="<_io.FileIO name=6 mode='rb+' closefd=True>" mode='r+' encoding='utf-8'>
tp         = <class 'numpy.clongdouble'>
x          = (1+0j)
../venv/lib/python3.11/site-packages/numpy/core/tests/test_print.py:118: AssertionError
___________________________ TestRealScalars.test_str ___________________________
self = <numpy.core.tests.test_scalarprint.TestRealScalars object at 0xffff4d1bd310>
    def test_str(self):
        svals = [0.0, -0.0, 1, -1, np.inf, -np.inf, np.nan]
        styps = [np.float16, np.float32, np.float64, np.longdouble]
        wanted = [
             ['0.0',  '0.0',  '0.0',  '0.0' ],
             ['-0.0', '-0.0', '-0.0', '-0.0'],
             ['1.0',  '1.0',  '1.0',  '1.0' ],
             ['-1.0', '-1.0', '-1.0', '-1.0'],
             ['inf',  'inf',  'inf',  'inf' ],
             ['-inf', '-inf', '-inf', '-inf'],
             ['nan',  'nan',  'nan',  'nan']]
    
        for wants, val in zip(wanted, svals):
            for want, styp in zip(wants, styps):
                msg = 'for str({}({}))'.format(np.dtype(styp).name, repr(val))
>               assert_equal(str(styp(val)), want, err_msg=msg)
E               AssertionError: 
E               Items are not equal: for str(float128(-0.0))
E                ACTUAL: '0.0'
E                DESIRED: '-0.0'
msg        = 'for str(float128(-0.0))'
self       = <numpy.core.tests.test_scalarprint.TestRealScalars object at 0xffff4d1bd310>
styp       = <class 'numpy.longdouble'>
styps      = [<class 'numpy.float16'>, <class 'numpy.float32'>, <class 'numpy.float64'>, <class 'numpy.longdouble'>]
svals      = [0.0, -0.0, 1, -1, inf, -inf, ...]
val        = -0.0
want       = '-0.0'
wanted     = [['0.0', '0.0', '0.0', '0.0'], ['-0.0', '-0.0', '-0.0', '-0.0'], ['1.0', '1.0', '1.0', '1.0'], ['-1.0', '-1.0', '-1.0', '-1.0'], ['inf', 'inf', 'inf', 'inf'], ['-inf', '-inf', '-inf', '-inf'], ...]
wants      = ['-0.0', '-0.0', '-0.0', '-0.0']
../venv/lib/python3.11/site-packages/numpy/core/tests/test_scalarprint.py:29: AssertionError
____________________ TestRealScalars.test_dragon4_interface ____________________
self = <numpy.core.tests.test_scalarprint.TestRealScalars object at 0xffff4e353510>
    def test_dragon4_interface(self):
        tps = [np.float16, np.float32, np.float64]
        # test is flaky for musllinux on np.float128
        if hasattr(np, 'float128') and not IS_MUSL:
            tps.append(np.float128)
    
        fpos = np.format_float_positional
        fsci = np.format_float_scientific
    
        for tp in tps:
            # test padding
>           assert_equal(fpos(tp('1.0'), pad_left=4, pad_right=4), "   1.    ")
E           AssertionError: 
E           Items are not equal:
E            ACTUAL: '   0.    '
E            DESIRED: '   1.    '
fpos       = <function format_float_positional at 0xffff89575260>
fsci       = <function format_float_scientific at 0xffff895751c0>
self       = <numpy.core.tests.test_scalarprint.TestRealScalars object at 0xffff4e353510>
tp         = <class 'numpy.longdouble'>
tps        = [<class 'numpy.float16'>, <class 'numpy.float32'>, <class 'numpy.float64'>, <class 'numpy.longdouble'>]
../venv/lib/python3.11/site-packages/numpy/core/tests/test_scalarprint.py:274: AssertionError
________________________ test_float_to_string_cast[g-S] ________________________
str_dt = 'S', float_dt = dtype('float128')
    @pytest.mark.parametrize("str_dt", ["S", "U"])
    @pytest.mark.parametrize("float_dt", np.typecodes["AllFloat"])
    def test_float_to_string_cast(str_dt, float_dt):
        float_dt = np.dtype(float_dt)
        fi = np.finfo(float_dt)
        arr = np.array([np.nan, np.inf, -np.inf, fi.max, fi.min], dtype=float_dt)
        expected = ["nan", "inf", "-inf", repr(fi.max), repr(fi.min)]
        if float_dt.kind == 'c':
            expected = [f"({r}+0j)" for r in expected]
    
        res = arr.astype(str_dt)
>       assert_array_equal(res, np.array(expected, dtype=str_dt))
arr        = <[ValueError('not enough values to unpack (expected 2, got 1)') raised in repr()] ndarray object at 0xffff4d2b2df0>
expected   = ['nan', 'inf', '-inf', 'nan', 'nan']
fi         = finfo(resolution=-1.7515355235394798696e-2315, min=-nan, max=nan, dtype=float128)
float_dt   = dtype('float128')
res        = array([b'0.0', b'0e+00', b'0e+00', b'nan', b'nan'], dtype='|S48')
str_dt     = 'S'
../venv/lib/python3.11/site-packages/numpy/core/tests/test_strings.py:99: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
args = (<built-in function eq>, array([b'0.0', b'0e+00', b'0e+00', b'nan', b'nan'], dtype='|S48'), array([b'nan', b'inf', b'-inf', b'nan', b'nan'], dtype='|S4'))
kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True}
    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Arrays are not equal
E           
E           Mismatched elements: 3 / 5 (60%)
E            x: array([b'0.0', b'0e+00', b'0e+00', b'nan', b'nan'], dtype='|S48')
E            y: array([b'nan', b'inf', b'-inf', b'nan', b'nan'], dtype='|S4')
args       = (<built-in function eq>, array([b'0.0', b'0e+00', b'0e+00', b'nan', b'nan'], dtype='|S48'), array([b'nan', b'inf', b'-inf', b'nan', b'nan'], dtype='|S4'))
func       = <function assert_array_compare at 0xffff87352160>
kwds       = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True}
self       = <contextlib._GeneratorContextManager object at 0xffff8740f4d0>
/opt/python/cp311-cp311/lib/python3.11/contextlib.py:81: AssertionError
________________________ test_float_to_string_cast[g-U] ________________________
str_dt = 'U', float_dt = dtype('float128')
    @pytest.mark.parametrize("str_dt", ["S", "U"])
    @pytest.mark.parametrize("float_dt", np.typecodes["AllFloat"])
    def test_float_to_string_cast(str_dt, float_dt):
        float_dt = np.dtype(float_dt)
        fi = np.finfo(float_dt)
        arr = np.array([np.nan, np.inf, -np.inf, fi.max, fi.min], dtype=float_dt)
        expected = ["nan", "inf", "-inf", repr(fi.max), repr(fi.min)]
        if float_dt.kind == 'c':
            expected = [f"({r}+0j)" for r in expected]
    
        res = arr.astype(str_dt)
>       assert_array_equal(res, np.array(expected, dtype=str_dt))
arr        = <[ValueError('not enough values to unpack (expected 2, got 1)') raised in repr()] ndarray object at 0xffff4d2b3750>
expected   = ['nan', 'inf', '-inf', 'nan', 'nan']
fi         = finfo(resolution=-1.7515355235394798696e-2315, min=-nan, max=nan, dtype=float128)
float_dt   = dtype('float128')
res        = array(['0.0', '0e+00', '0e+00', 'nan', 'nan'], dtype='<U48')
str_dt     = 'U'
../venv/lib/python3.11/site-packages/numpy/core/tests/test_strings.py:99: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
args = (<built-in function eq>, array(['0.0', '0e+00', '0e+00', 'nan', 'nan'], dtype='<U48'), array(['nan', 'inf', '-inf', 'nan', 'nan'], dtype='<U4'))
kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True}
    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Arrays are not equal
E           
E           Mismatched elements: 3 / 5 (60%)
E            x: array(['0.0', '0e+00', '0e+00', 'nan', 'nan'], dtype='<U48')
E            y: array(['nan', 'inf', '-inf', 'nan', 'nan'], dtype='<U4')
args       = (<built-in function eq>, array(['0.0', '0e+00', '0e+00', 'nan', 'nan'], dtype='<U48'), array(['nan', 'inf', '-inf', 'nan', 'nan'], dtype='<U4'))
func       = <function assert_array_compare at 0xffff87352160>
kwds       = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True}
self       = <contextlib._GeneratorContextManager object at 0xffff8740f4d0>
/opt/python/cp311-cp311/lib/python3.11/contextlib.py:81: AssertionError
=============================== warnings summary ===============================

xref gh-23972 for general longdouble support

rgommers added a commit to rgommers/numpy that referenced this issue Jun 18, 2023
rgommers added a commit to rgommers/numpy that referenced this issue Jun 18, 2023
rgommers added a commit to rgommers/numpy that referenced this issue Jun 18, 2023
rgommers added a commit to rgommers/numpy that referenced this issue Jun 18, 2023
@rgommers
Copy link
Member Author

These failures will likely have to do with this warning, one of the few warnings visible in the Meson build logs in CI:

  [115/254] Compiling C object numpy/core/_multiarray_umath.cpython-39-i386-linux-gnu.so.p/src_multiarray_dragon4.c.o
  ../../numpy/core/src/multiarray/dragon4.c: In function ‘Dragon4_Positional_LongDouble_opt’:
  ../../numpy/core/src/multiarray/dragon4.c:3075:9: warning: implicit declaration of function ‘Dragon4_PrintFloat_Intel_extended128’; did you mean ‘Dragon4_PrintFloat_Intel_extended’? [-Wimplicit-function-declaration]
   3075 |     if (Dragon4_PrintFloat_##format(scratch, val, opt) < 0) {\
        |         ^~~~~~~~~~~~~~~~~~~
  ../../numpy/core/src/multiarray/dragon4.c:3143:9: note: in expansion of macro ‘make_dragon4_typefuncs_inner’
   3143 |         make_dragon4_typefuncs_inner(Type, npy_type, format)
        |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ../../numpy/core/src/multiarray/dragon4.c:3148:1: note: in expansion of macro ‘make_dragon4_typefuncs’
   3148 | make_dragon4_typefuncs(LongDouble, npy_longdouble, NPY_LONGDOUBLE_BINFMT_NAME)
        | ^~~~~~~~~~~~~~~~~~~~~~
  At top level:
  ../../numpy/core/src/multiarray/dragon4.c:2507:1: warning: ‘Dragon4_PrintFloat_Intel_extended’ defined but not used [-Wunused-function]
   2507 | Dragon4_PrintFloat_Intel_extended(
        | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant
0