Browse Source

Math: workaround rounding errors in assert tests in latest GCC (glibc?).

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.
pull/542/merge
Vladimír Vondruš 4 years ago
parent
commit
fb51f25a7b
  1. 12
      src/Magnum/Math/Test/ComplexTest.cpp
  2. 12
      src/Magnum/Math/Test/QuaternionTest.cpp

12
src/Magnum/Math/Test/ComplexTest.cpp

@ -516,18 +516,18 @@ void ComplexTest::matrixNotRotation() {
/* Shear, using rotation() instead of rotationScaling() as that isn't /* Shear, using rotation() instead of rotationScaling() as that isn't
supposed to "fix" the shear */ supposed to "fix" the shear */
Complex::fromMatrix((Matrix3::scaling({2.0f, 1.0f})* 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 /* Reflection, using rotation() instead of rotationScaling() as that isn't
supposed to "fix" the reflection either */ supposed to "fix" the reflection either */
Complex::fromMatrix((Matrix3::scaling({-1.0f, 1.0f})* Complex::fromMatrix((Matrix3::scaling({-1.0f, 1.0f})*
Matrix3::rotation(37.0_degf)).rotation()); Matrix3::rotation(45.0_degf)).rotation());
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
"Math::Complex::fromMatrix(): the matrix is not a rotation:\n" "Math::Complex::fromMatrix(): the matrix is not a rotation:\n"
"Matrix(0.935781, -0.833258,\n" "Matrix(0.894427, -0.894427,\n"
" 0.352581, 0.552885)\n" " 0.447214, 0.447214)\n"
"Math::Complex::fromMatrix(): the matrix is not a rotation:\n" "Math::Complex::fromMatrix(): the matrix is not a rotation:\n"
"Matrix(-0.798635, 0.601815,\n" "Matrix(-0.707107, 0.707107,\n"
" 0.601815, 0.798635)\n"); " 0.707107, 0.707107)\n");
} }
void ComplexTest::lerp() { void ComplexTest::lerp() {

12
src/Magnum/Math/Test/QuaternionTest.cpp

@ -618,19 +618,19 @@ void QuaternionTest::matrixNotRotation() {
/* Shear, using rotation() instead of rotationScaling() as that isn't /* Shear, using rotation() instead of rotationScaling() as that isn't
supposed to "fix" the shear */ supposed to "fix" the shear */
Quaternion::fromMatrix((Matrix4::scaling({2.0f, 1.0f, 1.0f})* 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 /* Reflection, using rotation() instead of rotationScaling() as that isn't
supposed to "fix" the reflection either */ supposed to "fix" the reflection either */
Quaternion::fromMatrix((Matrix4::scaling({-1.0f, 1.0f, 1.0f})* 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(), CORRADE_COMPARE(out.str(),
"Math::Quaternion::fromMatrix(): the matrix is not a rotation:\n" "Math::Quaternion::fromMatrix(): the matrix is not a rotation:\n"
"Matrix(0.935781, -0.833258, 0,\n" "Matrix(0.894427, -0.894427, 0,\n"
" 0.352581, 0.552885, 0,\n" " 0.447214, 0.447214, 0,\n"
" 0, 0, 1)\n" " 0, 0, 1)\n"
"Math::Quaternion::fromMatrix(): the matrix is not a rotation:\n" "Math::Quaternion::fromMatrix(): the matrix is not a rotation:\n"
"Matrix(-0.798635, 0.601815, 0,\n" "Matrix(-0.707107, 0.707107, 0,\n"
" 0.601815, 0.798635, 0,\n" " 0.707107, 0.707107, 0,\n"
" 0, 0, 1)\n"); " 0, 0, 1)\n");
} }

Loading…
Cancel
Save