From fb51f25a7b613aa5be744deea5a4ddb88f3de064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 12 Dec 2021 20:52:09 +0100 Subject: [PATCH] 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. --- src/Magnum/Math/Test/ComplexTest.cpp | 12 ++++++------ src/Magnum/Math/Test/QuaternionTest.cpp | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Magnum/Math/Test/ComplexTest.cpp b/src/Magnum/Math/Test/ComplexTest.cpp index 18a472068..ae47f97e2 100644 --- a/src/Magnum/Math/Test/ComplexTest.cpp +++ b/src/Magnum/Math/Test/ComplexTest.cpp @@ -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() { diff --git a/src/Magnum/Math/Test/QuaternionTest.cpp b/src/Magnum/Math/Test/QuaternionTest.cpp index 274cb9b3c..84de14c5d 100644 --- a/src/Magnum/Math/Test/QuaternionTest.cpp +++ b/src/Magnum/Math/Test/QuaternionTest.cpp @@ -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"); }