diff --git a/test/array_cwise.cpp b/test/array_cwise.cpp index 5a4c28278..319eba303 100644 --- a/test/array_cwise.cpp +++ b/test/array_cwise.cpp @@ -144,6 +144,22 @@ Scalar calc_overflow_threshold(const ScalarExponent exponent) { } } +template ::IsInteger> +struct ref_pow { + static Base run(Base base, Exponent exponent) { + EIGEN_USING_STD(pow); + return pow(base, static_cast(exponent)); + } +}; + +template +struct ref_pow { + static Base run(Base base, Exponent exponent) { + EIGEN_USING_STD(pow); + return pow(base, exponent); + } +}; + template void test_exponent(Exponent exponent) { const Base max_abs_bases = static_cast(10000); @@ -166,9 +182,8 @@ void test_exponent(Exponent exponent) { if (exponent < 0 && base == 0) continue; x.setConstant(base); y = x.pow(exponent); - EIGEN_USING_STD(pow); - Base e = pow(base, static_cast(exponent)); for (Base a : y) { + Base e = ref_pow::run(base, exponent); bool pass = (a == e); if (!NumTraits::IsInteger) { pass = pass || (((numext::isfinite)(e) && internal::isApprox(a, e)) ||