From b5bef9dcb09d3fa2eeb913419902fbad03fe8e4b Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Fri, 18 Jul 2025 17:58:48 -0700 Subject: [PATCH] Fix bug in Erfc introduced in !1862. --- unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h b/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h index 1c3ce8738..228a7a5d4 100644 --- a/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h +++ b/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h @@ -323,7 +323,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T generic_fast_erfc::run(const T& x const T num = ppolevl::run(q2, gamma); const T denom = pmul(x, ppolevl::run(q2, delta)); const T r = pdiv(num, denom); - const T maybe_two = pand(pcmp_lt(x, pset1(0.0)), pset1(2.0)); + const T maybe_two = pselect(pcmp_lt(x, pset1(0.0)), pset1(2.0), pset1(0.0)); const T erfc_large = pmadd(z, r, maybe_two); return pselect(x_abs_gt_one_mask, erfc_large, erfc_small); } @@ -397,7 +397,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T erfc_double_large(const T& x, const T& x const T num_large = ppolevl::run(q2, gamma); const T denom_large = pmul(x, ppolevl::run(q2, delta)); const T r = pdiv(num_large, denom_large); - const T maybe_two = pand(pcmp_lt(x, pset1(0.0)), pset1(2.0)); + const T maybe_two = pselect(pcmp_lt(x, pset1(0.0)), pset1(2.0), pset1(0.0)); return pmadd(z, r, maybe_two); }