Skip to content

Commit abced86

Browse files
committed
improve cube function
1 parent 92a5151 commit abced86

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

include/units/units.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,8 +580,10 @@ template <isQuantity Q, isQuantity S = Exponentiated<Q, std::ratio<2>>> constexp
580580
return lhs * lhs;
581581
}
582582

583+
constexpr double cube(double lhs) { return lhs * lhs * lhs; }
584+
583585
template <isQuantity Q, isQuantity S = Exponentiated<Q, std::ratio<3>>> constexpr S cube(const Q& lhs) {
584-
return pow<3>(lhs);
586+
return lhs * lhs * lhs;
585587
}
586588

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

0 commit comments

Comments
 (0)