diff --git a/src/core/include/mp-units/math.h b/src/core/include/mp-units/math.h index 0feb9624d..490445a2f 100644 --- a/src/core/include/mp-units/math.h +++ b/src/core/include/mp-units/math.h @@ -229,7 +229,7 @@ template */ template requires requires { get_common_quantity_spec(get_quantity_spec(R) * get_quantity_spec(S), get_quantity_spec(T)); } && - (get_unit(R) * get_unit(S) == get_unit(T)) && requires(Rep1 v1, Rep2 v2, Rep3 v3) { + (equivalent(get_unit(R) * get_unit(S), get_unit(T))) && requires(Rep1 v1, Rep2 v2, Rep3 v3) { requires requires { fma(v1, v2, v3); } || requires { std::fma(v1, v2, v3); }; } [[nodiscard]] constexpr QuantityOf */ template requires requires { get_common_quantity_spec(get_quantity_spec(R) * get_quantity_spec(S), get_quantity_spec(T)); } && - (get_unit(R) * get_unit(S) == get_unit(T)) && requires(Rep1 v1, Rep2 v2, Rep3 v3) { + (equivalent(get_unit(R) * get_unit(S), get_unit(T))) && requires(Rep1 v1, Rep2 v2, Rep3 v3) { requires requires { fma(v1, v2, v3); } || requires { std::fma(v1, v2, v3); }; } [[nodiscard]] constexpr QuantityPointOf< @@ -326,7 +326,7 @@ template template [[nodiscard]] constexpr quantity(R), Rep> floor(const quantity& q) noexcept requires((!treat_as_floating_point) || requires(Rep v) { floor(v); } || requires(Rep v) { std::floor(v); }) && - (To == get_unit(R) || requires { + (equivalent(To, get_unit(R)) || requires { q.force_in(To); quantity_values::one(); }) @@ -339,14 +339,14 @@ template }; if constexpr (treat_as_floating_point) { using std::floor; - if constexpr (To == get_unit(R)) { + if constexpr (equivalent(To, get_unit(R))) { return {static_cast(floor(q.numerical_value_ref_in(q.unit))), detail::clone_reference_with(R)}; } else { return handle_signed_results( quantity{static_cast(floor(q.force_numerical_value_in(To))), detail::clone_reference_with(R)}); } } else { - if constexpr (To == get_unit(R)) { + if constexpr (equivalent(To, get_unit(R))) { return q.force_in(To); } else { return handle_signed_results(q.force_in(To)); @@ -363,7 +363,7 @@ template template [[nodiscard]] constexpr quantity(R), Rep> ceil(const quantity& q) noexcept requires((!treat_as_floating_point) || requires(Rep v) { ceil(v); } || requires(Rep v) { std::ceil(v); }) && - (To == get_unit(R) || requires { + (equivalent(To, get_unit(R)) || requires { q.force_in(To); quantity_values::one(); }) @@ -376,14 +376,14 @@ template }; if constexpr (treat_as_floating_point) { using std::ceil; - if constexpr (To == get_unit(R)) { + if constexpr (equivalent(To, get_unit(R))) { return {static_cast(ceil(q.numerical_value_ref_in(q.unit))), detail::clone_reference_with(R)}; } else { return handle_signed_results( quantity{static_cast(ceil(q.force_numerical_value_in(To))), detail::clone_reference_with(R)}); } } else { - if constexpr (To == get_unit(R)) { + if constexpr (equivalent(To, get_unit(R))) { return q.force_in(To); } else { return handle_signed_results(q.force_in(To)); @@ -402,12 +402,12 @@ template template [[nodiscard]] constexpr quantity(R), Rep> round(const quantity& q) noexcept requires((!treat_as_floating_point) || requires(Rep v) { round(v); } || requires(Rep v) { std::round(v); }) && - (To == get_unit(R) || requires { + (equivalent(To, get_unit(R)) || requires { ::mp_units::floor(q); quantity_values::one(); }) { - if constexpr (To == get_unit(R)) { + if constexpr (equivalent(To, get_unit(R))) { if constexpr (treat_as_floating_point) { using std::round; return {static_cast(round(q.numerical_value_ref_in(q.unit))), detail::clone_reference_with(R)};