summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-05-06 10:45:19 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-05-06 10:16:15 +0000
commitb09812daf72afae4b07526c9398a1c5f5ce90d57 (patch)
tree198520aa0d06b505aeece914f19f9f402be511be
parent8649cb770d1b60fa3945b51a9e8dd5e2fa901004 (diff)
Workaround mingw compiler bug
std::acosh(v) wrongly returns NaN for v == Inf on mingw. This makes the ecmascript tests fail. Fixes: QTBUG-93175 Change-Id: Ic6677b3259dad591b946b23d4d6a6859f6e70b0f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 3a8c0fd5cb9bfec439c306593bce19f434c871ce) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/qml/jsruntime/qv4mathobject.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4mathobject.cpp b/src/qml/jsruntime/qv4mathobject.cpp
index 382185657e..aad38339e4 100644
--- a/src/qml/jsruntime/qv4mathobject.cpp
+++ b/src/qml/jsruntime/qv4mathobject.cpp
@@ -148,6 +148,11 @@ ReturnedValue MathObject::method_acosh(const FunctionObject *, const Value *, co
#ifdef Q_OS_ANDROID // incomplete std :-(
RETURN_RESULT(Encode(std::log(v +std::sqrt(v + 1) * std::sqrt(v - 1))));
#else
+#ifdef Q_CC_MINGW
+ // Mingw has a broken std::acosh(). It returns NaN when passed Infinity.
+ if (std::isinf(v))
+ RETURN_RESULT(Encode(v));
+#endif
RETURN_RESULT(Encode(std::acosh(v)));
#endif
}