diff options
author | Antonio Sanchez <cantonios@google.com> | 2021-03-16 20:12:46 -0700 |
---|---|---|
committer | Antonio Sanchez <cantonios@google.com> | 2021-03-16 20:12:46 -0700 |
commit | 8dfe1029a5012774d50bfc39569e49e34d3152e0 (patch) | |
tree | 699510b229742363b7c51d416815de69affaa04a /Eigen/src/Core/arch/Default | |
parent | eb71e5db988d4a23e619ed054efd3eb751cdd026 (diff) |
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
Diffstat (limited to 'Eigen/src/Core/arch/Default')
-rw-r--r-- | Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 411640ee8..87e8c2703 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -135,7 +135,7 @@ Packet pldexp_generic(const Packet& a, const Packet& exponent) { // Explicitly multiplies // a * (2^e) // clamping e to the range -// [numeric_limits<Scalar>::min_exponent-2, numeric_limits<Scalar>::max_exponent] +// [NumTraits<Scalar>::min_exponent()-2, NumTraits<Scalar>::max_exponent()] // // This is approx 7x faster than pldexp_impl, but will prematurely over/underflow // if 2^e doesn't fit into a normal floating-point Scalar. @@ -1480,8 +1480,8 @@ Packet generic_pow(const Packet& x, const Packet& y) { const Packet y_is_nan = pandnot(ptrue(y), pcmp_eq(y, y)); const Packet abs_y_is_inf = pcmp_eq(pabs(y), cst_pos_inf); EIGEN_CONSTEXPR Scalar huge_exponent = - (std::numeric_limits<Scalar>::max_exponent * Scalar(EIGEN_LN2)) / - std::numeric_limits<Scalar>::epsilon(); + (NumTraits<Scalar>::max_exponent() * Scalar(EIGEN_LN2)) / + NumTraits<Scalar>::epsilon(); const Packet abs_y_is_huge = pcmp_le(pset1<Packet>(huge_exponent), pabs(y)); // Predicates for whether y is integer and/or even. |