Skip to content

Commit

Permalink
improve cube function
Browse files Browse the repository at this point in the history
  • Loading branch information
SizzinSeal committed Jan 8, 2025
1 parent 92a5151 commit abced86
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/units/units.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,10 @@ template <isQuantity Q, isQuantity S = Exponentiated<Q, std::ratio<2>>> constexp
return lhs * lhs;
}

constexpr double cube(double lhs) { return lhs * lhs * lhs; }

template <isQuantity Q, isQuantity S = Exponentiated<Q, std::ratio<3>>> constexpr S cube(const Q& lhs) {
return pow<3>(lhs);
return lhs * lhs * lhs;
}

template <int R, isQuantity Q, isQuantity S = Rooted<Q, std::ratio<R>>> constexpr S root(const Q& lhs) {
Expand Down

0 comments on commit abced86

Please sign in to comment.