Comments (4)
Hi,
There were many bug fixes since 1.60 (see here for more details).
Would you please try again with the latest version of Boost?
from test.
Sorry for the late investigation. It turns out that you cannot use BOOST_CHECK_CLOSE
to compare to the value 0
, as it would use the algorithm described here.
You have 2 options:
- either use
BOOST_CHECK_SMALL(-4.37113883e-08, 1.)
(note.
in the1.
) - or use
BOOST_TEST(-4.37113883e-08 == 0, 1. % tt::tolerance())
(for percentage tolerance)
Hope that helps!
from test.
Thank you @raffienficiaud
I have retried with 1.69 and the same behavior.
Could nt find a better perf than writing my own CHECK macro doing :
CHECK_CLOSE(result, ref)
if (result == 0 || ref == 0)
BOOST_CHECK_SMALL(result - ref, 0.01f);
else
BOOST_CHECK_CLOSE(result, ref, 0.01f);
Mathematically speaking, it is legit to wonder if 0.0000001 is "close" to 0 (within a range).
Should nt it be illogic to expect BOOST_CHECK_CLOSE() to work even if left or right are 0 ?
from test.
If you look at the equations for comparison here, then only equation (1) can work when one of the arguments u
or v
is 0
. This is why there exists BOOST_CHECK_SMALL
and BOOST_CHECK_CLOSE
.
On the other hand, this is done automatically with BOOST_TEST
if
- one of the arguments is floating point (since 1.70, otherwise the two arguments should be floating points)
- and one of the argument is zero,
so you should not be needing to write your own logic.
from test.
Related Issues (20)
- BOOST_DATA_TEST_CASE doesn't compile when a variable `t` is present
- execution_monitor.ipp dosn't compile with glibc 2.17 HOT 1
- BOOST_TEST_LOG_FORMAT=XML not generating valid XML HOT 2
- Missing formats for --list_content
- Overflow warning in `print_helper.hpp`
- Unexpected behavior with `--run_test` HOT 2
- When using MSVC, collections always require their element type to be comparable
- Unit-test runs for 30 minutes when BOOST_TEST used in the loop
- question: how to correctly create print helpers for '<<' explicitly removed in C++20? HOT 2
- Implement benchmark support
- Problems to read the documentation
- Bug in documentation formatting
- free(): invalid pointer at test exit HOT 8
- Invalid free/delete error in Boost.Test with minimal test case on Boost 1.85 HOT 1
- Report the exception text from BOOST_CHECK_NO_THROW
- Documentation: outdated links
- Documentation: no changhe log since 1.79.0
- Spectre mitigation warning on progress_monitor code
- Warnings on Windows Clang in header code
- Warnings on Windows GCC in header code
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from test.