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

Function pow_impl_float

src/fl/math/math.cpp.hpp:322–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320}
321
322float pow_impl_float(float base, float exponent) {
323#if FL_MATH_USE_LIBM
324 return ::powf(base, exponent);
325#else
326 if (exponent == 0.0f) return 1.0f;
327 int ie = static_cast<int>(exponent);
328 if (static_cast<float>(ie) == exponent && ie >= -8 && ie <= 8) {
329 float r = 1.0f;
330 if (ie > 0) { for (int i = 0; i < ie; ++i) r *= base; return r; }
331 if (ie < 0) { for (int i = 0; i < -ie; ++i) r *= base; return 1.0f / r; }
332 }
333 if (base <= 0.0f) return 0.0f;
334 return exp_impl_float(exponent * detail::log_natural_<float>(base));
335#endif
336}
337
338double pow_impl_double(double base, double exponent) {
339#if FL_MATH_USE_LIBM

Callers 2

powfFunction · 0.85
powFunction · 0.85

Calls 2

powfFunction · 0.85
exp_impl_floatFunction · 0.85

Tested by

no test coverage detected