forked from mpusz/mp-units
fabs() removed as abs() is enough
This commit is contained in:
@@ -59,12 +59,6 @@ constexpr Quantity AUTO abs(const quantity<D, U, Rep>& q) noexcept
|
|||||||
return quantity<D, U, Rep>(std::abs(q.count()));
|
return quantity<D, U, Rep>(std::abs(q.count()));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename D, typename U, typename Rep>
|
|
||||||
constexpr Quantity AUTO fabs(const quantity<D, U, Rep>& q) noexcept
|
|
||||||
{
|
|
||||||
return quantity<D, U, Rep>(std::fabs(q.count()));
|
|
||||||
}
|
|
||||||
|
|
||||||
template<Quantity Q>
|
template<Quantity Q>
|
||||||
constexpr Quantity AUTO epsilon() noexcept
|
constexpr Quantity AUTO epsilon() noexcept
|
||||||
{
|
{
|
||||||
|
@@ -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]")
|
TEST_CASE("absolute functions on quantity returns the absolute value", "[math][abs][fabs]")
|
||||||
{
|
{
|
||||||
SECTION ("'abs()' on a negative quantity returns the abs") {
|
SECTION ("'abs()' on a negative quantity returns the abs")
|
||||||
|
{
|
||||||
|
SECTION ("integral representation")
|
||||||
|
{
|
||||||
REQUIRE(abs(-1q_m) == 1q_m);
|
REQUIRE(abs(-1q_m) == 1q_m);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION ("'abs()' on a positive quantity returns the abs") {
|
SECTION ("floating-point representation")
|
||||||
|
{
|
||||||
|
REQUIRE(abs(-1.q_m) == 1q_m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION ("'abs()' on a positive quantity returns the abs")
|
||||||
|
{
|
||||||
|
SECTION ("integral representation")
|
||||||
|
{
|
||||||
REQUIRE(abs(1q_m) == 1q_m);
|
REQUIRE(abs(1q_m) == 1q_m);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION ("'fabs()' on a negative quantity returns the abs") {
|
SECTION ("floating-point representation")
|
||||||
REQUIRE(fabs(-1.q_m) == 1.q_m);
|
{
|
||||||
|
REQUIRE(abs(1.q_m) == 1q_m);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION ("'fabs()' on a positive quantity returns the abs") {
|
|
||||||
REQUIRE(fabs(1.q_m) == 1.q_m);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user