jscript: Remove NaN related FIXMEs.

This commit is contained in:
Piotr Caban 2009-06-03 21:11:20 +02:00 committed by Alexandre Julliard
parent 931554dd4a
commit eb203a149b
5 changed files with 18 additions and 8 deletions

View File

@ -81,11 +81,8 @@ static const WCHAR setUTCFullYearW[] = {'s','e','t','U','T','C','F','u','l','l',
/* ECMA-262 3rd Edition 15.9.1.14 */
static inline DOUBLE time_clip(DOUBLE time)
{
/* FIXME: Handle inf */
if(8.64e15 < time || time < -8.64e15) {
FIXME("return NaN\n");
return 0.0;
return ret_nan();
}
return floor(time);

View File

@ -351,8 +351,8 @@ static HRESULT JSGlobal_parseInt(DispatchEx *dispex, LCID lcid, WORD flags, DISP
HRESULT hres;
if(!arg_cnt(dp)) {
FIXME("NAN\n");
return E_NOTIMPL;
if(retv) num_set_nan(retv);
return S_OK;
}
if(arg_cnt(dp) >= 2) {

View File

@ -255,6 +255,13 @@ static inline void num_set_nan(VARIANT *v)
#endif
}
static inline DOUBLE ret_nan()
{
VARIANT v;
num_set_nan(&v);
return V_R8(&v);
}
static inline void num_set_inf(VARIANT *v, BOOL positive)
{
V_VT(v) = VT_R8;

View File

@ -254,8 +254,8 @@ static HRESULT String_charCodeAt(DispatchEx *dispex, LCID lcid, WORD flags, DISP
return hres;
if(V_VT(&v) != VT_I4 || V_I4(&v) < 0 || V_I4(&v) >= length) {
FIXME("NAN\n");
return E_FAIL;
if(retv) num_set_nan(&v);
return S_OK;
}
idx = V_I4(&v);

View File

@ -934,6 +934,12 @@ var date = new Date();
date = new Date(100);
ok(date.getTime() === 100, "date.getTime() = " + date.getTime());
ok(Date.prototype.getTime() === 0, "date.prototype.getTime() = " + Date.prototype.getTime());
date = new Date(8.64e15);
ok(date.getTime() === 8.64e15, "date.getTime() = " + date.getTime());
date = new Date(8.64e15+1);
ok(isNaN(0+date.getTime()), "date.getTime() is not NaN");
date = new Date(Infinity);
ok(isNaN(0+date.getTime()), "date.getTime() is not NaN");
ok(typeof(Math.PI) === "number", "typeof(Math.PI) = " + typeof(Math.PI));
ok(Math.floor(Math.PI*100) === 314, "Math.PI = " + Math.PI);