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

Function FloatForCompare

src/OpenColorIO/MathUtils.cpp:397–400  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Map a floating-point number (already represented as an integer) to an ordered integer representation, allowing for a tolerance-based comparison. Floating-point numbers have their magnitude stored in the bits 0-30 as a pair of exponent and mantissa, while the sign is stored on bit 31. That makes the positive floating-p

Source from the content-addressed store, hash-verified

395// +------------+-----------------+------------------+------------------+-----------------+-----------+
396//
397inline int FloatForCompare(const unsigned floatBits)
398{
399 return floatBits < 0x80000000 ? (0x80000000 + floatBits) : (0x80000000 - (floatBits & 0x7FFFFFFF));
400}
401
402//------------------------------------------------------------------------------
403//

Callers 1

FloatsDifferFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected