diff --git a/test/packetmath.cpp b/test/packetmath.cpp index f29417b98..23aa33fc2 100644 --- a/test/packetmath.cpp +++ b/test/packetmath.cpp @@ -52,6 +52,12 @@ inline T REF_FREXP(const T& x, T& exp) { EIGEN_USING_STD(frexp) const T out = static_cast(frexp(x, &iexp)); exp = static_cast(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; }