Browse Source

Fixed a bug in the equalModuloPrecision function.

Former-commit-id: 465d90b4a7
tempestpy_adaptions
PBerger 11 years ago
parent
commit
cd46a6b0c6
  1. 3
      src/utility/vector.h

3
src/utility/vector.h

@ -330,6 +330,9 @@ namespace storm {
template<class T> template<class T>
bool equalModuloPrecision(T const& val1, T const& val2, T precision, bool relativeError = true) { bool equalModuloPrecision(T const& val1, T const& val2, T precision, bool relativeError = true) {
if (relativeError) { if (relativeError) {
if (val2 == 0) {
return (std::abs(val1) <= precision);
}
if (std::abs(val1 - val2)/val2 > precision) return false; if (std::abs(val1 - val2)/val2 > precision) return false;
} else { } else {
if (std::abs(val1 - val2) > precision) return false; if (std::abs(val1 - val2) > precision) return false;

Loading…
Cancel
Save