From a82a9d8fe2deffa823e896da5be149334ea87ba7 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Wed, 16 Dec 2020 17:57:04 +0100 Subject: [PATCH] fix: `exp()` has sense only for dimensionless quantities Resolves #178 --- src/include/units/math.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/include/units/math.h b/src/include/units/math.h index b0d77117..4275c085 100644 --- a/src/include/units/math.h +++ b/src/include/units/math.h @@ -74,14 +74,15 @@ template /** * @brief Computes Euler's raised to the given power * + * @note Such an operation has sense only for a dimensionless quantity. + * * @param q Quantity being the base of the operation * @return Quantity The value of the same quantity type */ -template -[[nodiscard]] inline quantity exp(const quantity& q) +template +[[nodiscard]] inline dimensionless exp(const dimensionless& q) { - using coherent_unit = dimension_unit; - return quantity_cast(quantity(std::exp(quantity_cast(q).count()))); + return quantity_cast(dimensionless(std::exp(quantity_cast(q).count()))); } /**