Fix arm32 issues.

This commit is contained in:
Antonio Sánchez
2024-01-23 22:04:55 +00:00
parent 5808122017
commit a73970a864
4 changed files with 19 additions and 9 deletions

View File

@@ -98,9 +98,12 @@ void binary_op_test(std::string name, Fn fun, RefFn ref) {
Scalar a = actual(i, j);
#if EIGEN_ARCH_ARM
// Work around NEON flush-to-zero mode
// if ref returns denormalized value and Eigen returns 0, then skip the test
int ref_fpclass = std::fpclassify(e);
if (a == Scalar(0) && ref_fpclass == FP_SUBNORMAL) continue;
// if ref returns a subnormal value and Eigen returns 0, then skip the test
if (a == Scalar(0) &&
(e > -(std::numeric_limits<Scalar>::min)() && e < (std::numeric_limits<Scalar>::min)() &&
e >= -std::numeric_limits<Scalar>::denorm_min() && e <= std::numeric_limits<Scalar>::denorm_min())) {
continue;
}
#endif
bool success = (a == e) || ((numext::isfinite)(e) && internal::isApprox(a, e, tol)) ||
((numext::isnan)(a) && (numext::isnan)(e));