From d259104c8de1e43619327f5d7f6a0dbb372f3f66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20S=C3=A1nchez?= Date: Thu, 24 Feb 2022 22:16:37 +0000 Subject: [PATCH] Fix frexp packetmath tests for MSVC. (cherry picked from commit 2ed4bee78fc44b37d5e5b9f532f5659f9c978499) --- test/packetmath.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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; }