From 8dfe1029a5012774d50bfc39569e49e34d3152e0 Mon Sep 17 00:00:00 2001 From: Antonio Sanchez Date: Tue, 16 Mar 2021 20:12:46 -0700 Subject: Augment NumTraits with min/max_exponent() again. Replace usage of `std::numeric_limits<...>::min/max_exponent` in codebase where possible. Also replaced some other `numeric_limits` usages in affected tests with the `NumTraits` equivalent. The previous MR !443 failed for c++03 due to lack of `constexpr`. Because of this, we need to keep around the `std::numeric_limits` version in enum expressions until the switch to c++11. Fixes #2148 --- Eigen/src/Core/StableNorm.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Eigen/src/Core/StableNorm.h') diff --git a/Eigen/src/Core/StableNorm.h b/Eigen/src/Core/StableNorm.h index 04fe0b371..4a3f0cca8 100644 --- a/Eigen/src/Core/StableNorm.h +++ b/Eigen/src/Core/StableNorm.h @@ -134,9 +134,9 @@ blueNorm_impl(const EigenBase& _vec) // statements can be replaced static const int ibeta = std::numeric_limits::radix; // base for floating-point numbers static const int it = NumTraits::digits(); // number of base-beta digits in mantissa - static const int iemin = std::numeric_limits::min_exponent; // minimum exponent - static const int iemax = std::numeric_limits::max_exponent; // maximum exponent - static const RealScalar rbig = (std::numeric_limits::max)(); // largest floating-point number + static const int iemin = NumTraits::min_exponent(); // minimum exponent + static const int iemax = NumTraits::max_exponent(); // maximum exponent + static const RealScalar rbig = NumTraits::highest(); // largest floating-point number static const RealScalar b1 = RealScalar(pow(RealScalar(ibeta),RealScalar(-((1-iemin)/2)))); // lower boundary of midrange static const RealScalar b2 = RealScalar(pow(RealScalar(ibeta),RealScalar((iemax + 1 - it)/2))); // upper boundary of midrange static const RealScalar s1m = RealScalar(pow(RealScalar(ibeta),RealScalar((2-iemin)/2))); // scaling factor for lower range -- cgit v1.2.3