Skip to content

Commit

Permalink
improve sqrt function
Browse files Browse the repository at this point in the history
  • Loading branch information
SizzinSeal committed Jan 8, 2025
1 parent 11450e9 commit 5975763
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/units/units.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,8 @@ template <int R, isQuantity Q, isQuantity S = Rooted<Q, std::ratio<R>>> constexp
return S(std::pow(lhs.internal(), 1.0 / R));
}

constexpr double sqrt(double lhs) { return std::sqrt(lhs); }

template <isQuantity Q, isQuantity S = Rooted<Q, std::ratio<2>>> constexpr S sqrt(const Q& lhs) { return root<2>(lhs); }

template <isQuantity Q, isQuantity S = Rooted<Q, std::ratio<3>>> constexpr S cbrt(const Q& lhs) { return root<3>(lhs); }
Expand Down

0 comments on commit 5975763

Please sign in to comment.