ValueFlow: Fixed isEqual

This commit is contained in:
Daniel Marjamäki 2021-01-10 16:52:11 +01:00
parent 98c7c0af96
commit 707f1f2fbe
1 changed files with 6 additions and 1 deletions

View File

@ -345,7 +345,12 @@ static bool isComputableValue(const Token* parent, const ValueFlow::Value& value
template<class T>
static bool isEqual(T x, T y) {
T diff = (x > y) ? x - y : y - x;
return x == y;
}
template<>
bool isEqual<double>(double x, double y) {
const double diff = (x > y) ? x - y : y - x;
return !((diff / 2) < diff);
}