[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] odd/eraseme_limits 7e36141 3/6: Don't write lowest()
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] odd/eraseme_limits 7e36141 3/6: Don't write lowest() as "min()" even it they're the same |
Date: |
Sat, 6 Mar 2021 17:57:41 -0500 (EST) |
branch: odd/eraseme_limits
commit 7e361416944dab86a3a979ff6a1df3dd8c5d19bd
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Don't write lowest() as "min()" even it they're the same
---
math_functions.hpp | 7 +------
monnaie_test.cpp | 7 +------
tn_range.tpp | 7 +------
3 files changed, 3 insertions(+), 18 deletions(-)
diff --git a/math_functions.hpp b/math_functions.hpp
index bc6d59d..668c9eb 100644
--- a/math_functions.hpp
+++ b/math_functions.hpp
@@ -101,12 +101,7 @@ inline T outward_quotient(T numerator, T denominator)
// "INT_MIN / -1" would overflow; but "false/bool(-1)" would not,
// hence the "T(-1) < 0" test.
- // Make sure min() means lowest().
- static_assert
- ( std::numeric_limits<T>::min()
- == std::numeric_limits<T>::lowest()
- );
- constexpr T min = std::numeric_limits<T>::min();
+ constexpr T min = std::numeric_limits<T>::lowest();
if(min == numerator && T(-1) < 0 && T(-1) == denominator)
{
throw std::domain_error("Division might overflow.");
diff --git a/monnaie_test.cpp b/monnaie_test.cpp
index a580f1b..60de3e1 100644
--- a/monnaie_test.cpp
+++ b/monnaie_test.cpp
@@ -91,13 +91,8 @@ void monnaie_test::test_ctors()
,std::overflow_error
,overflow_msg
);
- // Make sure min() means lowest().
- static_assert
- ( std::numeric_limits<monnaie::amount_type>::min()
- == std::numeric_limits<monnaie::amount_type>::lowest()
- );
LMI_TEST_THROW
- (monnaie(std::numeric_limits<monnaie::amount_type>::min(), 0)
+ (monnaie(std::numeric_limits<monnaie::amount_type>::lowest(), 0)
,std::overflow_error
,overflow_msg
);
diff --git a/tn_range.tpp b/tn_range.tpp
index 1ed1221..3814f89 100644
--- a/tn_range.tpp
+++ b/tn_range.tpp
@@ -78,12 +78,7 @@ namespace
{
static_assert(std::numeric_limits<T>::is_bounded);
static_assert(!std::is_floating_point_v<T>);
- // Make sure min() means lowest().
- static_assert
- ( std::numeric_limits<T>::min()
- == std::numeric_limits<T>::lowest()
- );
- static T const lower_limit = std::numeric_limits<T>::min();
+ static T const lower_limit = std::numeric_limits<T>::lowest();
static T const upper_limit = std::numeric_limits<T>::max();
return lower_limit < t && t < upper_limit;
}
- [lmi-commits] [lmi] branch odd/eraseme_limits created (now 5e7ba88), Greg Chicares, 2021/03/06
- [lmi-commits] [lmi] odd/eraseme_limits 2a83f41 1/6: Improve unit test, Greg Chicares, 2021/03/06
- [lmi-commits] [lmi] odd/eraseme_limits e43dd18 2/6: Don't write lowest() as "min()" without asserting they're the same, Greg Chicares, 2021/03/06
- [lmi-commits] [lmi] odd/eraseme_limits 7e36141 3/6: Don't write lowest() as "min()" even it they're the same,
Greg Chicares <=
- [lmi-commits] [lmi] odd/eraseme_limits 5bf69bf 4/6: Fix defect introduced 20180319T1957Z: min() isn't lowest(), Greg Chicares, 2021/03/06
- [lmi-commits] [lmi] odd/eraseme_limits 700e166 5/6: Define 'minmax' of an empty vector, Greg Chicares, 2021/03/06
- [lmi-commits] [lmi] odd/eraseme_limits 5e7ba88 6/6: Specialize std::numeric_limits, sort of, Greg Chicares, 2021/03/06