Fix frexp packetmath tests for MSVC.

(cherry picked from commit 2ed4bee78fc44b37d5e5b9f532f5659f9c978499)
This commit is contained in:
Antonio Sánchez 2022-02-24 22:16:37 +00:00 committed by Antonio Sanchez
parent cd543434bf
commit d259104c8d

View File

@ -52,6 +52,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;
}