![]() |
Shamrock 2025.10.0
Astrophysical Code
|
Integer powers with a supplied reciprocal, so a negative exponent never divides. More...
Go to the source code of this file.
Namespaces | |
| namespace | shamunits |
| namespace containing the units library | |
Functions | |
| template<int power, class T> | |
| constexpr T | shamunits::details::pow_constexpr_fast_inv (T a, T a_inv) noexcept |
| Constexpr power expansion function with supplied inverse for negative values. | |
| template<class T> | |
| constexpr T | shamunits::details::ipow (T a, int n, T a_inv) noexcept |
| Runtime twin of pow_constexpr_fast_inv, for an exponent only known at run time. | |
Integer powers with a supplied reciprocal, so a negative exponent never divides.
Definition in file utils.hpp.
|
inlineconstexprnoexcept |
Runtime twin of pow_constexpr_fast_inv, for an exponent only known at run time.
Same square-and-multiply order (most significant bit first), so for any n it returns exactly what pow_constexpr_fast_inv<n> returns. The caller supplies the reciprocal, so a negative exponent uses a_inv and never divides.