Skip to content

BUG: test_rint_big_int fails on Core 2 Duo CPU due to precision #22170

@apteryks

Description

@apteryks

Describe the issue:

Building Numpy 1.23.1 with GNU Guix on an old Core 2 Duo (Intel Q6700) CPU, I stumbled on the test_rint_big_int failure (see below for the error message).

The error seems to be related to precision, perhaps specific to this x86_64 architecture

Reproduce the code example:

It seems to be reproducible every time I build on this Core 2 Duo machine.

Reproducible by disabling CPU feature SSE41 on runtime via:

export NPY_DISABLE_CPU_FEATURES="SSE41"

Error message:

=================================== FAILURES ===================================
______________________________ test_rint_big_int _______________________________
[gw0] linux -- Python 3.9.13 /gnu/store/ir68khi30jzdlcn9sjw0anlgsgsjfjfi-python-3.9.13/bin/python3

    def test_rint_big_int():
        # np.rint bug for large integer values on Windows 32-bit and MKL
        # https://github.com/numpy/numpy/issues/6685
        val = 4607998452777363968
        # This is exactly representable in floating point
        assert_equal(val, int(float(val)))
        # Rint should not change the value
>       assert_equal(val, np.rint(val))
E       AssertionError: 
E       Items are not equal:
E        ACTUAL: 4607998452777363968
E        DESIRED: 4.6079984527773635e+18

val        = 4607998452777363968

/gnu/store/bg6dygk3x2dpc15s40k61hy37nzhaiw2-python-numpy-1.23.1/lib/python3.9/site-packages/numpy/core/tests/test_umath.py:3875: AssertionError
=========================== short test summary info ============================
FAILED ../../core/tests/test_umath.py::test_rint_big_int - AssertionError: 
= 1 failed, 17805 passed, 1370 skipped, 35 xfailed, 7 xpassed in 474.41s (0:07:54) =
error: in phase 'check': uncaught exception:
%exception #<&invoke-error program: "./runtests.py" arguments: ("-vv" "--no-build" "--mode=fast" "-j" "4" "--" "-n" "4" "-k" "not test_float_remainder_overflow and not test_pareto") exit-status: 1 term-signal: #f stop-signal: #f> 
phase `check' failed after 476.8 seconds

NumPy/Python version information:

1.23.1

Context for the issue:

Occurs while running the test suite during packaging.

EDIT(Sayed): Reproduce

Metadata

Metadata

Assignees

Labels

00 - Bugcomponent: SIMDIssues in SIMD (fast instruction sets) code or machinery

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions