test_sqrt function in mul.cpp got failed. Need to change rounding mode for MXCSR.
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the rounding-mode handling in mul.cpp and the reproducer shown in the issue, then run the test while linking with Intel's LIBM via -limf. Done means the x87 and MXCSR rounding modes are both handled so the test_sqrt checks for (2, 3) and (5, 7) pass.
Written by the indexing model from the issue text.
Description
Code to reproduce:
#include <boost/numeric/interval.hpp>
#include <boost/test/minimal.hpp>
#include "bugs.hpp"
typedef boost::numeric::interval I;
static bool test_sqrt(double al, double au) {
I a(al, au);
I b = square(sqrt(a));
return subset(abs(a), b);
}
int test_main(int, char*[]) {
BOOST_CHECK(test_sqrt(2, 3));
BOOST_CHECK(test_sqrt(5, 7));
return 0;
}
When linking with -limf(Intel's LIBM Math library), this test would got failed when running. Below is the error message.
test.cpp(15): test test_sqrt(2, 3) failed in function: 'int test_main(int, char **)'
test.cpp(16): test test_sqrt(5, 7) failed in function: 'int test_main(int, char **)'
**** 2 errors detected
This test changed rounding mode only on x87 FPU control register (bits 10 and 11) but not on MXCSR register (bits 13 and 14). There are functions in LIBM that could use x87 or simd instructions. In this case, SSE version of sqrt is called and it uses "sqrtsd %xmm0,%xmm0" instruction. This sqrtsd instruction uses the rounding mode that is in the MXCSR. Therefore, the rounding bits in MXCSR should be updated as well.
- Dominant language
- C++
- Stars
- 31
- Forks
- 49
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 3
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/interval
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 10/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
All issues in boostorg/interval
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Qiskit/qiskit-aer#2466 ·
-
feature request
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 2 days
-
status:needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
PX4/PX4-Autopilot#29006 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Segfault in pwStreamAddBuffer: createBuffer() returning nullptr is dereferenced (Screencopy.cpp:943)Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100