diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-05-06 10:45:19 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-05-06 10:39:44 +0000 |
commit | 5afffb740102fc8baf0e5ca3afe67f27fcf43704 (patch) | |
tree | b3c6251067b445c469fbf5e08832551f397192ac /src/qml | |
parent | 80a2d788d509a67896de2dd043afbea689ce9339 (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>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/jsruntime/qv4mathobject.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4mathobject.cpp b/src/qml/jsruntime/qv4mathobject.cpp index c6b74e7aba..f4941c2f0c 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 } |