Jacek Caban : jscript: Return NaN in Math. ceil if called without any argument.

Alexandre Julliard julliard at winehq.org
Wed Oct 22 08:00:18 CDT 2008


Module: wine
Branch: master
Commit: 9f1699b9a44f95eb7fa2f347121092984e9ce5a5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9f1699b9a44f95eb7fa2f347121092984e9ce5a5

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Oct 21 16:56:27 2008 -0700

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 d3d59ae..e6b7202 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 d613eb1..6378bdd 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);
 




More information about the wine-cvs mailing list