Creates a float that is the sum of 1/(2 ^ fractions[i]) for i in factions
| 666 | |
| 667 | // Creates a float that is the sum of 1/(2 ^ fractions[i]) for i in factions |
| 668 | float 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, |
no outgoing calls
no test coverage detected