jscript: Added Infinity value implementation.

This commit is contained in:
Jacek Caban 2008-10-16 14:31:18 -05:00 committed by Alexandre Julliard
parent f80b5f6e66
commit 9a7265becc
3 changed files with 34 additions and 2 deletions

View File

@ -126,8 +126,19 @@ static HRESULT JSGlobal_NaN(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
static HRESULT JSGlobal_Infinity(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_inf(retv, TRUE);
break;
default:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
}
return S_OK;
}
static HRESULT JSGlobal_Array(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,

View File

@ -252,6 +252,18 @@ static inline void num_set_nan(VARIANT *v)
#endif
}
static inline void num_set_inf(VARIANT *v, BOOL positive)
{
V_VT(v) = VT_R8;
#ifdef INFINITY
V_R8(v) = positive ? INFINITY : -INFINITY;
#else
V_UI8(v) = (ULONGLONG)0x7ff00000<<32;
if(!positive)
V_R8(v) = -V_R8(v);
#endif
}
const char *debugstr_variant(const VARIANT*);
HRESULT WINAPI JScriptFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**);

View File

@ -787,9 +787,18 @@ if (true)
ok(isNaN(NaN) === true, "isNaN(NaN) !== true");
ok(isNaN(0.5) === false, "isNaN(0.5) !== false");
ok(isNaN(Infinity) === false, "isNaN(Infinity) !== 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");
ok(isNaN(+undefined) === true, "isNaN(+undefined) !== true");
ok(isFinite(0.5) === true, "isFinite(0.5) !== true");
ok(isFinite(Infinity) === false, "isFinite(Infinity) !== fals");
ok(isFinite(-Infinity) === false, "isFinite(Infinity) !== fals");
ok(isFinite(NaN) === false, "isFinite(NaN) !== false");
ok(isFinite(0.5, NaN) === true, "isFinite(0.5, NaN) !== true");
ok(isFinite(NaN, 0.5) === false, "isFinite(NaN, 0.5) !== false");
ok(isFinite() === false, "isFinite() !== false");
reportSuccess();