8000 BUG: deal with broken hypot() for MSVC on win32 by pv · Pull Request #9574 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: deal with broken hypot() for MSVC on win32 #9574

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

Merged
merged 3 commits into from
Aug 16, 2017
Merged

Conversation

pv
Copy link
Member
@pv pv commented Aug 16, 2017

Blacklist hypot() for MSVC on win32, because it appears to change
the FPU precision mode.

To be sure that nothing else in numpy messes with the FPU mode, check
in all tests in the testsuite that the FPU mode was not changed. The
MSVC bug will manifest (I tested this) as a test failure. I also added the
corresponding pytest checks, for future.

Fixes: gh-9567

Example failures:

nose:

======================================================================
FAIL: numpy.core.tests.test_umath.TestHypotSpecialValues.test_nan_outputs
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\pauli\src\numpy\build\testenv\Lib\site-packages\numpy\testing\nose_tools\noseclasses.
py", line 339, in run
    "test".format(old_mode, new_mode))
AssertionError: FPU mode changed from 0x9001f to 0xc001f during the test


pytest:

________ ERROR at teardown of TestHypotSpecialValues.test_nan_outputs _________

request = <SubRequest 'check_fpu_mode' for <Function 'test_nan_outputs'>>

    @pytest.fixture(scope="function", autouse=True)
    def check_fpu_mode(request):
        """
        Check FPU precision mode was not changed during the test.
        """
        old_mode = get_fpu_mode()
        yield
        new_mode = get_fpu_mode()

        if old_mode != new_mode:
            raise AssertionError("FPU precision mode changed from {0:#x} to {1:#x}"
>                                " during the test".format(old_mode, new_mode))
E           AssertionError: FPU precision mode changed from 0x9001f to 0xc001f during the test

..\build\testenv\Lib\site-packages\numpy\conftest.py:47: AssertionError

pv added 3 commits August 16, 2017 16:35
Emit a test failure if the FPU mode changes when running a test case,
allowing to pinpoint what test caused the mode change.
@charris
Copy link
Member
charris commented Aug 16, 2017

Thanks Pauli.

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

Successfully merging this pull request may close these issues.

On win32, np.absolute changes floating point control word
2 participants
0