jscript: Added NaN value implementation.

oldstable
Jacek Caban 2008-10-15 18:49:51 -05:00 committed by Alexandre Julliard
parent ad1c1c6107
commit 53ade93cd9
3 changed files with 26 additions and 2 deletions

View File

@ -108,8 +108,19 @@ static HRESULT constructor_call(DispatchEx *constr, LCID lcid, WORD flags, DISPP
static HRESULT JSGlobal_NaN(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
TRACE("\n");
switch(flags) {
case DISPATCH_PROPERTYGET:
num_set_nan(retv);
break;
default:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
}
return S_OK;
}
static HRESULT JSGlobal_Infinity(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,

View File

@ -242,6 +242,16 @@ static inline void num_set_val(VARIANT *v, DOUBLE d)
}
}
static inline void num_set_nan(VARIANT *v)
{
V_VT(v) = VT_R8;
#ifdef NAN
V_R8(v) = NAN;
#else
V_UI8(v) = (ULONGLONG)0x7ff80000<<32;
#endif
}
const char *debugstr_variant(const VARIANT*);
HRESULT WINAPI JScriptFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**);

View File

@ -785,7 +785,10 @@ if (true)
else
ok(true, "else should be associated with nearest if statement");
ok(isNaN(NaN) === true, "isNaN(NaN) !== true");
ok(isNaN(0.5) === false, "isNaN(0.5) !== false");
ok(isNaN() === true, "isNaN() !== true");
ok(isNaN(NaN, 0) === true, "isNaN(NaN, 0) !== true");
ok(isNaN(0.5, NaN) === false, "isNaN(0.5, NaN) !== false");
reportSuccess();