From 9f1699b9a44f95eb7fa2f347121092984e9ce5a5 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 21 Oct 2008 16:56:27 -0700 Subject: [PATCH] jscript: Return NaN in Math.ceil if called without any argument. --- dlls/jscript/math.c | 5 +++-- dlls/jscript/tests/api.js | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/jscript/math.c b/dlls/jscript/math.c index d3d59ae22c6..e6b7202e1a2 100644 --- a/dlls/jscript/math.c +++ b/dlls/jscript/math.c @@ -174,8 +174,9 @@ static HRESULT Math_ceil(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS * TRACE("\n"); if(!arg_cnt(dp)) { - FIXME("arg_cnt = 0\n"); - return E_NOTIMPL; + if(retv) + num_set_nan(retv); + return S_OK; } hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v); diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index d613eb1a263..6378bdd86ec 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -431,6 +431,9 @@ ok(tmp === 1, "Math.ceil(true) = " + tmp); tmp = Math.ceil(1.1, 3, 4); ok(tmp === 2, "Math.ceil(1.1, 3, 4) = " + tmp); +tmp = Math.ceil(); +ok(isNaN(tmp), "ceil() is not NaN"); + tmp = Math.floor(0.5); ok(tmp === 0, "Math.floor(0.5) = " + tmp); -- 2.11.4.GIT