mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix code and unit test for a few corner cases in vectorized pow()
(cherry picked from commit 7a87ed1b6a)
This commit is contained in:
committed by
Antonio Sanchez
parent
61efca2e90
commit
a9490cd3c5
@@ -72,9 +72,9 @@ void pow_test() {
|
||||
for (int j = 0; j < num_cases; ++j) {
|
||||
Scalar e = static_cast<Scalar>(std::pow(x(i,j), y(i,j)));
|
||||
Scalar a = actual(i, j);
|
||||
bool fail = !(a==e) && !internal::isApprox(a, e, tol) && !((numext::isnan)(a) && (numext::isnan)(e));
|
||||
all_pass &= !fail;
|
||||
if (fail) {
|
||||
bool success = (a==e) || ((numext::isfinite)(e) && internal::isApprox(a, e, tol)) || ((numext::isnan)(a) && (numext::isnan)(e));
|
||||
all_pass &= success;
|
||||
if (!success) {
|
||||
std::cout << "pow(" << x(i,j) << "," << y(i,j) << ") = " << a << " != " << e << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user