diff --git a/src/include/units/math.h b/src/include/units/math.h index 745be47e..497c4dbd 100644 --- a/src/include/units/math.h +++ b/src/include/units/math.h @@ -59,12 +59,6 @@ constexpr Quantity AUTO abs(const quantity& q) noexcept return quantity(std::abs(q.count())); } -template -constexpr Quantity AUTO fabs(const quantity& q) noexcept -{ - return quantity(std::fabs(q.count())); -} - template constexpr Quantity AUTO epsilon() noexcept { diff --git a/test/unit_test/runtime/math_test.cpp b/test/unit_test/runtime/math_test.cpp index 74c3b48c..617c1e5f 100644 --- a/test/unit_test/runtime/math_test.cpp +++ b/test/unit_test/runtime/math_test.cpp @@ -56,20 +56,30 @@ TEST_CASE("'sqrt()' on quantity changes the value and the dimension accordingly" TEST_CASE("absolute functions on quantity returns the absolute value", "[math][abs][fabs]") { - SECTION ("'abs()' on a negative quantity returns the abs") { - REQUIRE(abs(-1q_m) == 1q_m); + SECTION ("'abs()' on a negative quantity returns the abs") + { + SECTION ("integral representation") + { + REQUIRE(abs(-1q_m) == 1q_m); + } + + SECTION ("floating-point representation") + { + REQUIRE(abs(-1.q_m) == 1q_m); + } } - SECTION ("'abs()' on a positive quantity returns the abs") { - REQUIRE(abs(1q_m) == 1q_m); - } + SECTION ("'abs()' on a positive quantity returns the abs") + { + SECTION ("integral representation") + { + REQUIRE(abs(1q_m) == 1q_m); + } - SECTION ("'fabs()' on a negative quantity returns the abs") { - REQUIRE(fabs(-1.q_m) == 1.q_m); - } - - SECTION ("'fabs()' on a positive quantity returns the abs") { - REQUIRE(fabs(1.q_m) == 1.q_m); + SECTION ("floating-point representation") + { + REQUIRE(abs(1.q_m) == 1q_m); + } } }