[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 3330a9a 3/7: Don't write lowest() as "min()"
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 3330a9a 3/7: Don't write lowest() as "min()" even it they're the same |
Date: |
Sat, 6 Mar 2021 17:55:54 -0500 (EST) |
branch: master
commit 3330a9ac7c86cb6395c0c06f3846ca10c11d7e32
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] master updated (27b708a -> 7d2794b), Greg Chicares, 2021/03/06
- [lmi-commits] [lmi] master 869de45 4/7: Fix defect introduced 20180319T1957Z: min() isn't lowest(), Greg Chicares, 2021/03/06
- [lmi-commits] [lmi] master 7d2794b 7/7: Use minmax<T> iff std::numeric_limits<T>::is_bounded, Greg Chicares, 2021/03/06
- [lmi-commits] [lmi] master 5004bd4 5/7: Define 'minmax' of an empty vector, Greg Chicares, 2021/03/06
- [lmi-commits] [lmi] master e23c058 6/7: Prefer data-member initializers to ctor delegation, Greg Chicares, 2021/03/06
- [lmi-commits] [lmi] master 24611b1 1/7: Improve a unit test, Greg Chicares, 2021/03/06
- [lmi-commits] [lmi] master 8e69f1d 2/7: Don't write lowest() as "min()" without asserting they're the same, Greg Chicares, 2021/03/06
- [lmi-commits] [lmi] master 3330a9a 3/7: Don't write lowest() as "min()" even it they're the same,
Greg Chicares <=