Fix frexp packetmath tests for MSVC.

This commit is contained in:
Antonio Sánchez 2022-02-24 22:16:37 +00:00
parent d58e629130
commit 2ed4bee78f

View File

@ -76,6 +76,12 @@ inline T REF_FREXP(const T& x, T& exp) {
EIGEN_USING_STD(frexp)
const T out = static_cast<T>(frexp(x, &iexp));
exp = static_cast<T>(iexp);
// The exponent value is unspecified if the input is inf or NaN, but MSVC
// seems to set it to 1. We need to set it back to zero for consistency.
if (!(numext::isfinite)(x)) {
exp = T(0);
}
return out;
}