mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-29 10:40:59 -06:00
changed: measure relative error in a more standard way (knuth)
|(value-expected)/expected| < tol or |(value-expected)/value| < tol instead of |(value-expected)/(value+expected)| this is how boost::test defines its check
This commit is contained in:
parent
778f486bcc
commit
3c1c3ba1f6
@ -66,8 +66,8 @@
|
||||
|
||||
#define CHECK_CLOSE(value, expected, reltol) \
|
||||
{ \
|
||||
if (std::fabs((expected) - (value)) > 1e-14 && \
|
||||
std::fabs(((expected) - (value))/((expected) + (value))) > reltol) \
|
||||
if (std::fabs((expected) - (value)) > reltol*std::fabs(expected) && \
|
||||
std::fabs((expected) - (value)) > reltol*std::fabs(value)) \
|
||||
{ \
|
||||
std::cerr << "Test failure: "; \
|
||||
std::cerr << "expected value " << expected << " is not close to value " << value << std::endl; \
|
||||
|
Loading…
Reference in New Issue
Block a user