mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-28 02:00: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
6d1f8c75d6
@ -59,8 +59,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)) \
|
||||
throw std::runtime_error("Test failed: " + std::to_string(value) + " != " + std::to_string(expected)); \
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user