Commit a78b4209 authored by James Willis's avatar James Willis
Browse files

Make sure the sum is greater than zero before performing division.

parent 52029aba
......@@ -578,7 +578,9 @@ int compare_values(double a, double b, double threshold, double *absDiff,
*absDiff = fabs(a - b);
*absSum = fabs(a + b);
*relDiff = *absDiff / *absSum;
if( *absSum > 0.f) {
*relDiff = *absDiff / *absSum;
}
if (*relDiff > threshold) {
result = 1;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment