From b09812daf72afae4b07526c9398a1c5f5ce90d57 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 6 May 2021 10:45:19 +0200 Subject: 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 Reviewed-by: Maximilian Goldstein Reviewed-by: Andrei Golubev (cherry picked from commit 3a8c0fd5cb9bfec439c306593bce19f434c871ce) Reviewed-by: Qt Cherry-pick Bot --- src/qml/jsruntime/qv4mathobject.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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 } -- cgit v1.2.3