MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / RelativeDifference

Function RelativeDifference

tests/osl/UnitTestOSL.cpp:98–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98inline 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.
112inline bool ComputeDiff(float x1, float x2, bool rel, float min_x1, float diff)

Callers 1

ComputeDiffFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected