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

Function pow_impl_double

src/fl/math/math.cpp.hpp:338–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

336}
337
338double pow_impl_double(double base, double exponent) {
339#if FL_MATH_USE_LIBM
340 return ::pow(base, exponent);
341#else
342 if (exponent == 0.0) return 1.0;
343 int ie = static_cast<int>(exponent);
344 if (static_cast<double>(ie) == exponent && ie >= -8 && ie <= 8) {
345 double r = 1.0;
346 if (ie > 0) { for (int i = 0; i < ie; ++i) r *= base; return r; }
347 if (ie < 0) { for (int i = 0; i < -ie; ++i) r *= base; return 1.0 / r; }
348 }
349 if (base <= 0.0) return 0.0;
350 return exp_impl_double(exponent * detail::log_natural_<double>(base));
351#endif
352}
353
354// Absolute value: pure arithmetic; libm path unnecessary, same on both.
355float fabs_impl_float(float value) {

Callers 1

powFunction · 0.85

Calls 2

exp_impl_doubleFunction · 0.85
powFunction · 0.70

Tested by

no test coverage detected