MCPcopy Create free account
hub / github.com/FastLED/FastLED / test_pow_two_ulps_below_one_impl

Function test_pow_two_ulps_below_one_impl

tests/fl/math/fixed_point.cpp:5171–5178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5169// Same as above, two LSBs below 1.0 -- also inside the snap window.
5170template <typename FP>
5171static void test_pow_two_ulps_below_one_impl() {
5172 const FP just_below = FP::from_raw(static_cast<raw_t<FP>>(FP::SCALE - 2));
5173 const FP one(1.0f);
5174 const FP gamma_2_8(2.8f);
5175 const FP gamma_3_2(3.2f);
5176 FL_CHECK_EQ(FP::pow(just_below, gamma_2_8).raw(), one.raw());
5177 FL_CHECK_EQ(FP::pow(just_below, gamma_3_2).raw(), one.raw());
5178}
5179
5180// For signed types: pow(0.5, 2.0) approx 0.25 -- well below 1.0, snap must NOT
5181// fire. Excludes u-types since their log2_fp doesn't support base < 1.0.

Callers

nothing calls this directly

Calls 2

powFunction · 0.50
rawMethod · 0.45

Tested by

no test coverage detected