Fast constexpr integer power (ipow)
A good optimizing compiler will transform tail-recursive functions to run as fast as imperative code. - SO
see also
- C++ Super Optimization: 1000X Faster - general overview of
constexpr
usage and optimisation- demo with recursive Fibonacci and prime number
- Fast alternative to pow()
ipow
double^int
Written on June 26, 2021, Last update on February 25, 2024
c++
math
power
recurse
optimize
fastware
Fibonacci