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

Function test_pow_basic_impl

tests/fl/math/fixed_point.cpp:718–733  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

716
717template<typename T>
718void test_pow_basic_impl(float pow_x_0_5_max, float pow_x_2_0_max) {
719 // 2^2 = 4 (safe for all types)
720 FL_CHECK_CLOSE(T::pow(T(2.0f), T(2.0f)).to_float(), 4.0f, pow_x_2_0_max);
721
722 // 4^0.5 = 2 (sqrt via pow)
723 FL_CHECK_CLOSE(T::pow(T(4.0f), T(0.5f)).to_float(), 2.0f, pow_x_0_5_max);
724
725 // x^0 = 1
726 FL_CHECK_CLOSE(T::pow(T(5.0f), T(0.0f)).to_float(), 1.0f, pow_x_2_0_max);
727
728 // 0^x = 0
729 FL_CHECK_EQ(T::pow(T(), T(2.0f)).raw(), raw_t<T>(0));
730
731 // negative base = 0
732 FL_CHECK_EQ(T::pow(T(-1.0f), T(2.0f)).raw(), raw_t<T>(0));
733}
734
735template<typename T>
736void test_pow_extended_impl(float pow_x_3_0_max) {

Callers

nothing calls this directly

Calls 4

TEnum · 0.85
powFunction · 0.50
to_floatMethod · 0.45
rawMethod · 0.45

Tested by

no test coverage detected