| 320 | } |
| 321 | |
| 322 | float 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 | |
| 338 | double pow_impl_double(double base, double exponent) { |
| 339 | #if FL_MATH_USE_LIBM |
no test coverage detected