| 336 | } |
| 337 | |
| 338 | double 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. |
| 355 | float fabs_impl_float(float value) { |
no test coverage detected