aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/jit/qv4baselinejit.cpp4
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp5
2 files changed, 7 insertions, 2 deletions
diff --git a/src/qml/jit/qv4baselinejit.cpp b/src/qml/jit/qv4baselinejit.cpp
index 764e75937e..cd07ac4d58 100644
--- a/src/qml/jit/qv4baselinejit.cpp
+++ b/src/qml/jit/qv4baselinejit.cpp
@@ -967,7 +967,9 @@ static ReturnedValue expHelper(const Value &base, const Value &exp)
{
double b = base.toNumber();
double e = exp.toNumber();
- return QV4::Encode(pow(b,e));
+ if (qIsInf(e) && (b == 1 || b == -1))
+ return Encode(qSNaN());
+ return Encode(pow(b,e));
}
void BaselineJIT::generate_Exp(int lhs) {
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index f9a56eb877..052d6f773b 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -1340,7 +1340,10 @@ QV4::ReturnedValue VME::interpret(CppStackFrame &frame, const char *code)
const Value left = STACK_VALUE(lhs);
double base = left.toNumber();
double exp = ACC.toNumber();
- acc = QV4::Encode(pow(base,exp));
+ if (qIsInf(exp) && (base == 1 || base == -1))
+ acc = Encode(qSNaN());
+ else
+ acc = Encode(pow(base,exp));
MOTH_END_INSTR(Exp)
MOTH_BEGIN_INSTR(Mul)