Skip to content

Commit

Permalink
Math: workaround rounding errors in assert tests in latest GCC (glibc?).
Browse files Browse the repository at this point in the history
Only in release. One of the number now had 6 at the end instead of 5.
Not my problem, so using a different angle to hopefully circumvent that.
  • Loading branch information
mosra committed Dec 12, 2021
1 parent 9fbc637 commit fb51f25
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/Magnum/Math/Test/ComplexTest.cpp
Expand Up @@ -516,18 +516,18 @@ void ComplexTest::matrixNotRotation() {
/* Shear, using rotation() instead of rotationScaling() as that isn't
supposed to "fix" the shear */
Complex::fromMatrix((Matrix3::scaling({2.0f, 1.0f})*
Matrix3::rotation(37.0_degf)).rotation());
Matrix3::rotation(45.0_degf)).rotation());
/* Reflection, using rotation() instead of rotationScaling() as that isn't
supposed to "fix" the reflection either */
Complex::fromMatrix((Matrix3::scaling({-1.0f, 1.0f})*
Matrix3::rotation(37.0_degf)).rotation());
Matrix3::rotation(45.0_degf)).rotation());
CORRADE_COMPARE(out.str(),
"Math::Complex::fromMatrix(): the matrix is not a rotation:\n"
"Matrix(0.935781, -0.833258,\n"
" 0.352581, 0.552885)\n"
"Matrix(0.894427, -0.894427,\n"
" 0.447214, 0.447214)\n"
"Math::Complex::fromMatrix(): the matrix is not a rotation:\n"
"Matrix(-0.798635, 0.601815,\n"
" 0.601815, 0.798635)\n");
"Matrix(-0.707107, 0.707107,\n"
" 0.707107, 0.707107)\n");
}

void ComplexTest::lerp() {
Expand Down
12 changes: 6 additions & 6 deletions src/Magnum/Math/Test/QuaternionTest.cpp
Expand Up @@ -618,19 +618,19 @@ void QuaternionTest::matrixNotRotation() {
/* Shear, using rotation() instead of rotationScaling() as that isn't
supposed to "fix" the shear */
Quaternion::fromMatrix((Matrix4::scaling({2.0f, 1.0f, 1.0f})*
Matrix4::rotationZ(37.0_degf)).rotation());
Matrix4::rotationZ(45.0_degf)).rotation());
/* Reflection, using rotation() instead of rotationScaling() as that isn't
supposed to "fix" the reflection either */
Quaternion::fromMatrix((Matrix4::scaling({-1.0f, 1.0f, 1.0f})*
Matrix4::rotationZ(37.0_degf)).rotation());
Matrix4::rotationZ(45.0_degf)).rotation());
CORRADE_COMPARE(out.str(),
"Math::Quaternion::fromMatrix(): the matrix is not a rotation:\n"
"Matrix(0.935781, -0.833258, 0,\n"
" 0.352581, 0.552885, 0,\n"
"Matrix(0.894427, -0.894427, 0,\n"
" 0.447214, 0.447214, 0,\n"
" 0, 0, 1)\n"
"Math::Quaternion::fromMatrix(): the matrix is not a rotation:\n"
"Matrix(-0.798635, 0.601815, 0,\n"
" 0.601815, 0.798635, 0,\n"
"Matrix(-0.707107, 0.707107, 0,\n"
" 0.707107, 0.707107, 0,\n"
" 0, 0, 1)\n");
}

Expand Down

0 comments on commit fb51f25

Please sign in to comment.