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

Function HalfsDiffer

src/OpenColorIO/MathUtils.cpp:539–571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

537}
538
539bool HalfsDiffer(const half expected, const half actual, const int tolerance)
540{
541 // TODO: Make this faster
542
543 // (These are ints rather than shorts to allow subtraction below.)
544 const int aimBits = HalfForCompare(expected);
545 const int valBits = HalfForCompare(actual);
546
547 if (expected.isNan())
548 {
549 return !actual.isNan();
550 }
551 else if (actual.isNan())
552 {
553 return !expected.isNan();
554 }
555 else if (expected.isInfinity())
556 {
557 return aimBits != valBits;
558 }
559 else if (actual.isInfinity())
560 {
561 return aimBits != valBits;
562 }
563 else
564 {
565 if (abs(valBits - aimBits) > tolerance)
566 {
567 return true;
568 }
569 }
570 return false;
571}
572
573} // namespace OCIO_NAMESPACE
574

Callers 3

isIdentityMethod · 0.85
OCIO_ADD_TESTFunction · 0.85
OCIO_ADD_TESTFunction · 0.85

Calls 1

HalfForCompareFunction · 0.85

Tested by 2

OCIO_ADD_TESTFunction · 0.68
OCIO_ADD_TESTFunction · 0.68