diff options
Diffstat (limited to 'tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp')
-rw-r--r-- | tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp index a4defcc7f2..ed93ff24b0 100644 --- a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp +++ b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp @@ -237,7 +237,7 @@ void tst_QQuaternion::length_data() QTest::newRow("-1y") << 0.0f << -1.0f << 0.0f << 0.0f << 1.0f; QTest::newRow("-1z") << 0.0f << 0.0f << -1.0f << 0.0f << 1.0f; QTest::newRow("-1w") << 0.0f << 0.0f << 0.0f << -1.0f << 1.0f; - QTest::newRow("two") << 2.0f << -2.0f << 2.0f << 2.0f << sqrtf(16.0f); + QTest::newRow("two") << 2.0f << -2.0f << 2.0f << 2.0f << std::sqrt(16.0f); } void tst_QQuaternion::length() { @@ -710,8 +710,9 @@ void tst_QQuaternion::fromAxisAndAngle() // http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q56 // to calculate the answer we expect to get. QVector3D vector = QVector3D(x1, y1, z1).normalized(); - float sin_a = sinf((angle * M_PI / 180.0) / 2.0); - float cos_a = cosf((angle * M_PI / 180.0) / 2.0); + const float a = (angle * M_PI / 180.0) / 2.0; + const float sin_a = std::sin(a); + const float cos_a = std::cos(a); QQuaternion result(cos_a, (vector.x() * sin_a), (vector.y() * sin_a), |