mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix basicstuff_8 casting test failure on loongarch64
libeigen/eigen!2379 Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
@@ -207,7 +207,12 @@ struct casting_test {
|
||||
Matrix<TgtScalar, 4, 4> n = m.template cast<TgtScalar>();
|
||||
for (int i = 0; i < m.rows(); ++i) {
|
||||
for (int j = 0; j < m.cols(); ++j) {
|
||||
VERIFY_IS_APPROX(n(i, j), (internal::cast<SrcScalar, TgtScalar>(m(i, j))));
|
||||
// Materialize both values to avoid GCC miscompilation at -O3 on some targets
|
||||
// (e.g., loongarch64) where the compiler may keep intermediate results in wider
|
||||
// FP registers, causing the comparison to see different precision than intended.
|
||||
TgtScalar actual = n(i, j);
|
||||
TgtScalar expected = internal::cast<SrcScalar, TgtScalar>(m(i, j));
|
||||
VERIFY_IS_APPROX(actual, expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user