aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4mathobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4mathobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4mathobject.cpp41
1 files changed, 0 insertions, 41 deletions
diff --git a/src/qml/jsruntime/qv4mathobject.cpp b/src/qml/jsruntime/qv4mathobject.cpp
index afe5c31db3..f81fd93b2d 100644
--- a/src/qml/jsruntime/qv4mathobject.cpp
+++ b/src/qml/jsruntime/qv4mathobject.cpp
@@ -145,16 +145,12 @@ ReturnedValue MathObject::method_acosh(const FunctionObject *, const Value *, co
if (v < 1)
RETURN_RESULT(Encode(qt_qnan()));
-#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
}
ReturnedValue MathObject::method_asin(const FunctionObject *, const Value *, const Value *argv, int argc)
@@ -171,12 +167,7 @@ ReturnedValue MathObject::method_asinh(const FunctionObject *, const Value *, co
double v = argc ? argv[0].toNumber() : 2;
if (v == 0.0)
RETURN_RESULT(Encode(v));
-
-#ifdef Q_OS_ANDROID // incomplete std :-(
- RETURN_RESULT(Encode(std::log(v +std::sqrt(1 + v * v))));
-#else
RETURN_RESULT(Encode(std::asinh(v)));
-#endif
}
ReturnedValue MathObject::method_atan(const FunctionObject *, const Value *, const Value *argv, int argc)
@@ -194,17 +185,7 @@ ReturnedValue MathObject::method_atanh(const FunctionObject *, const Value *, co
if (v == 0.0)
RETURN_RESULT(Encode(v));
-#ifdef Q_OS_ANDROID // incomplete std :-(
- if (-1 < v && v < 1)
- RETURN_RESULT(Encode(0.5 * (std::log(v + 1) - std::log(v - 1))));
-
- if (v > 1 || v < -1)
- RETURN_RESULT(Encode(qt_qnan()));
-
- RETURN_RESULT(Encode(copySign(qt_inf(), v)));
-#else
RETURN_RESULT(Encode(std::atanh(v)));
-#endif
}
ReturnedValue MathObject::method_atan2(const FunctionObject *, const Value *, const Value *argv, int argc)
@@ -228,11 +209,7 @@ ReturnedValue MathObject::method_atan2(const FunctionObject *, const Value *, co
ReturnedValue MathObject::method_cbrt(const FunctionObject *, const Value *, const Value *argv, int argc)
{
double v = argc ? argv[0].toNumber() : qt_qnan();
-#ifdef Q_OS_ANDROID // incomplete std :-(
- RETURN_RESULT(Encode(copySign(std::exp(std::log(std::abs(v)) / 3), v)));
-#else
RETURN_RESULT(Encode(std::cbrt(v))); // cube root
-#endif
}
ReturnedValue MathObject::method_ceil(const FunctionObject *, const Value *, const Value *argv, int argc)
@@ -286,11 +263,7 @@ ReturnedValue MathObject::method_expm1(const FunctionObject *, const Value *, co
else
RETURN_RESULT(Encode(qt_inf()));
} else {
-#ifdef Q_OS_ANDROID // incomplete std :-(
- RETURN_RESULT(Encode(std::exp(v) - 1));
-#else
RETURN_RESULT(Encode(std::expm1(v)));
-#endif
}
}
@@ -370,13 +343,7 @@ ReturnedValue MathObject::method_log2(const FunctionObject *, const Value *, con
if (v < 0) {
RETURN_RESULT(Encode(qt_qnan()));
} else {
-#ifdef Q_OS_ANDROID // incomplete std :-(
- // Android ndk r10e doesn't have std::log2, so fall back.
- const double ln2 = std::log(2.0);
- RETURN_RESULT(Encode(std::log(v) / ln2));
-#else
RETURN_RESULT(Encode(std::log2(v)));
-#endif
}
}
@@ -532,13 +499,5 @@ ReturnedValue MathObject::method_tanh(const FunctionObject *, const Value *, con
ReturnedValue MathObject::method_trunc(const FunctionObject *, const Value *, const Value *argv, int argc)
{
double v = argc ? argv[0].toNumber() : qt_qnan();
-#ifdef Q_OS_ANDROID // incomplete std :-(
- if (std::isnan(v) || qt_is_inf(v) || qIsNull(v))
- RETURN_RESULT(Encode(v));
- // Nearest integer not greater in magnitude:
- quint64 whole = std::abs(v);
- RETURN_RESULT(Encode(copySign(whole, v)));
-#else
RETURN_RESULT(Encode(std::trunc(v)));
-#endif
}