| 96 | } |
| 97 | |
| 98 | inline bool RelativeDifference(float x1, float x2, float min_x1, float diff) |
| 99 | { |
| 100 | const float absx1 = fabs(x1); |
| 101 | float div = std::max(absx1, min_x1); |
| 102 | const float thisDiff = fabs(x1 - x2) / div; |
| 103 | if (thisDiff > diff) |
| 104 | { |
| 105 | diff = thisDiff; |
| 106 | return true; |
| 107 | } |
| 108 | return false; |
| 109 | } |
| 110 | |
| 111 | // Return true if diff has been updated. |
| 112 | inline bool ComputeDiff(float x1, float x2, bool rel, float min_x1, float diff) |