Fix epsilon and dummy_precision values in long double for double doubles. Prevented some algorithms from converging on PPC.

(cherry picked from commit 54459214a1b9c67df04bc529474fca1ec9f4c84f)
This commit is contained in:
Chip Kerchner 2023-02-16 23:35:42 +00:00 committed by Antonio Sanchez
parent dae8c6d7ad
commit 8f1b6198c2
2 changed files with 13 additions and 3 deletions

View File

@ -248,8 +248,18 @@ template<> struct NumTraits<double> : GenericNumTraits<double>
template<> struct NumTraits<long double>
: GenericNumTraits<long double>
{
EIGEN_CONSTEXPR
static inline long double dummy_precision() { return 1e-15l; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
static inline long double dummy_precision() { return static_cast<long double>(1e-15l); }
#if defined(EIGEN_ARCH_PPC) && (__LDBL_MANT_DIG__ == 106)
// PowerPC double double causes issues with some values
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
static inline long double epsilon()
{
// 2^(-(__LDBL_MANT_DIG__)+1)
return static_cast<long double>(2.4651903288156618919116517665087e-32l);
}
#endif
};
template<typename _Real> struct NumTraits<std::complex<_Real> >

View File

@ -281,7 +281,7 @@ inline int MatrixPowerAtomic<MatrixType>::getPadeDegree(long double normIminusT)
#endif
int degree = 3;
for (; degree <= maxPadeDegree; ++degree)
if (normIminusT <= maxNormForPade[degree - 3])
if (normIminusT <= static_cast<long double>(maxNormForPade[degree - 3]))
break;
return degree;
}