Skip to content

Commit

Permalink
refactor: small math functions refactoring to make clang happy
Browse files Browse the repository at this point in the history
  • Loading branch information
mpusz committed Aug 26, 2023
1 parent 35efff6 commit af827ca
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utility/include/mp-units/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ template<Unit auto To, auto R, typename Rep>
if constexpr (To == get_unit(R)) {
return make_quantity<detail::clone_reference_with<To>(R)>(static_cast<Rep>(floor(q.value())));
} else {
return handle_signed_results(make_quantity<detail::clone_reference_with<To>(q.reference)>(
return handle_signed_results(make_quantity<detail::clone_reference_with<To>(R)>(
static_cast<Rep>(floor(value_cast<To>(q).value()))));
}
} else {
Expand Down Expand Up @@ -205,9 +205,9 @@ template<Unit auto To, auto R, typename Rep>
if constexpr (treat_as_floating_point<Rep>) {
using std::ceil;
if constexpr (To == get_unit(R)) {
return make_quantity<detail::clone_reference_with<To>(q.reference)>(static_cast<Rep>(ceil(q.value())));
return make_quantity<detail::clone_reference_with<To>(R)>(static_cast<Rep>(ceil(q.value())));
} else {
return handle_signed_results(make_quantity<detail::clone_reference_with<To>(q.reference)>(
return handle_signed_results(make_quantity<detail::clone_reference_with<To>(R)>(
static_cast<Rep>(ceil(value_cast<To>(q).value()))));
}
} else {
Expand Down Expand Up @@ -238,7 +238,7 @@ template<Unit auto To, auto R, typename Rep>
if constexpr (To == get_unit(R)) {
if constexpr (treat_as_floating_point<Rep>) {
using std::round;
return make_quantity<detail::clone_reference_with<To>(q.reference)>(static_cast<Rep>(round(q.value())));
return make_quantity<detail::clone_reference_with<To>(R)>(static_cast<Rep>(round(q.value())));
} else {
return value_cast<To>(q);
}
Expand Down

0 comments on commit af827ca

Please sign in to comment.