Commit 53ade93c authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Added NaN value implementation.

parent ad1c1c61
......@@ -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,
......
......@@ -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**);
......
......@@ -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();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment