Module: wine Branch: master Commit: f77489acd55eded4b7dfb1f75d5c35660a0de328 URL: http://source.winehq.org/git/wine.git/?a=commit;h=f77489acd55eded4b7dfb1f75d...
Author: Piotr Caban piotr.caban@gmail.com Date: Wed May 27 18:44:00 2009 +0200
jscript: Added implementation of Math_pow with less then 2 arguments.
---
dlls/jscript/math.c | 4 ++-- dlls/jscript/tests/api.js | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/jscript/math.c b/dlls/jscript/math.c index 1969ff7..9d609e5 100644 --- a/dlls/jscript/math.c +++ b/dlls/jscript/math.c @@ -441,8 +441,8 @@ static HRESULT Math_pow(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *d TRACE("\n");
if(arg_cnt(dp) < 2) { - FIXME("unimplemented arg_cnt %d\n", arg_cnt(dp)); - return E_NOTIMPL; + if(retv) num_set_nan(retv); + return S_OK; }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &x); diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index c1da8c8..a17b067 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -618,6 +618,12 @@ ok(tmp === 2, "Math.pow(2, 2) = " + tmp); tmp = Math.pow(2, 2, 3); ok(tmp === 4, "Math.pow(2, 2, 3) = " + tmp);
+tmp = Math.pow(2); +ok(isNaN(tmp), "Math.pow(2) is not NaN"); + +tmp = Math.pow(); +ok(isNaN(tmp), "Math.pow() is not NaN"); + tmp = Math.random(); ok(typeof(tmp) == "number", "typeof(tmp) = " + typeof(tmp)); ok(0 <= tmp && tmp <= 1, "Math.random() = " + tmp);