MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / float_fractions

Function float_fractions

test/hex_float_test.cpp:668–674  ·  view source on GitHub ↗

Creates a float that is the sum of 1/(2 ^ fractions[i]) for i in factions

Source from the content-addressed store, hash-verified

666
667// Creates a float that is the sum of 1/(2 ^ fractions[i]) for i in factions
668float float_fractions(const std::vector<uint32_t>& fractions) {
669 float f = 0;
670 for (int32_t i : fractions) {
671 f += std::ldexp(1.0f, -i);
672 }
673 return f;
674}
675
676// Returns the normalized significand of a HexFloat<FloatProxy<float>>
677// that was created by calling float_fractions with the input fractions,

Callers 3

normalized_significandFunction · 0.85
TESTFunction · 0.85
hex_float_test.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected