diff --git a/src/core/include/mp-units/bits/magnitude.h b/src/core/include/mp-units/bits/magnitude.h index 2d05ded0..6f9e238a 100644 --- a/src/core/include/mp-units/bits/magnitude.h +++ b/src/core/include/mp-units/bits/magnitude.h @@ -517,26 +517,26 @@ template //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Magnitude rational powers implementation. -template +template [[nodiscard]] consteval auto pow(magnitude) { - if constexpr (E.num == 0) { + if constexpr (Num == 0) { return magnitude<>{}; } else { - return magnitude()...>{}; + return magnitude()...>{}; } } template [[nodiscard]] consteval auto sqrt(magnitude m) { - return pow(m); + return pow<1, 2>(m); } template [[nodiscard]] consteval auto cbrt(magnitude m) { - return pow(m); + return pow<1, 3>(m); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -781,7 +781,7 @@ inline constexpr Magnitude auto mag = detail::prime_factorization_v / det */ template requires detail::gt_zero -inline constexpr Magnitude auto mag_power = pow(mag); +inline constexpr Magnitude auto mag_power = pow(mag); namespace detail { diff --git a/src/core/include/mp-units/unit.h b/src/core/include/mp-units/unit.h index 1906ab3f..f3d21baa 100644 --- a/src/core/include/mp-units/unit.h +++ b/src/core/include/mp-units/unit.h @@ -372,10 +372,9 @@ template if constexpr (requires { typename decltype(base.reference_unit)::_num_; }) { auto num = get_canonical_unit_impl(power{}, typename decltype(base.reference_unit)::_num_{}); auto den = get_canonical_unit_impl(power{}, typename decltype(base.reference_unit)::_den_{}); - return canonical_unit{pow::exponent>(base.mag) * num.mag / den.mag, - num.reference_unit / den.reference_unit}; + return canonical_unit{pow(base.mag) * num.mag / den.mag, num.reference_unit / den.reference_unit}; } else { - return canonical_unit{pow::exponent>(base.mag), + return canonical_unit{pow(base.mag), derived_unit, Num, Den...>>{}}; } }