From f3912891504ad965d5fe8bd11d7346faa69b4026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20S=C3=A1nchez?= Date: Thu, 25 Jan 2024 17:52:07 +0000 Subject: [PATCH] Fix bug in checking subnormals. --- test/array_cwise.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/array_cwise.cpp b/test/array_cwise.cpp index 91db3f959..543ef2e7a 100644 --- a/test/array_cwise.cpp +++ b/test/array_cwise.cpp @@ -97,11 +97,10 @@ void binary_op_test(std::string name, Fn fun, RefFn ref) { Scalar e = static_cast(ref(lhs(i, j), rhs(i, j))); Scalar a = actual(i, j); #if EIGEN_ARCH_ARM - // Work around NEON flush-to-zero mode - // if ref returns a subnormal value and Eigen returns 0, then skip the test - if (a == Scalar(0) && - (e > -(std::numeric_limits::min)() && e < (std::numeric_limits::min)() && - e >= -std::numeric_limits::denorm_min() && e <= std::numeric_limits::denorm_min())) { + // Work around NEON flush-to-zero mode. + // If ref returns a subnormal value and Eigen returns 0, then skip the test. + if (a == Scalar(0) && (e > -(std::numeric_limits::min)() && e < (std::numeric_limits::min)()) && + (e <= -std::numeric_limits::denorm_min() || e >= std::numeric_limits::denorm_min())) { continue; } #endif