jscript: Added Math.abs with no arg implementation.

This commit is contained in:
Jacek Caban 2008-10-16 14:31:58 -05:00 committed by Alexandre Julliard
parent 2e075e9862
commit 142cffc249
2 changed files with 12 additions and 2 deletions

View File

@ -121,8 +121,9 @@ static HRESULT Math_abs(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *d
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);

View File

@ -431,6 +431,15 @@ ok(tmp === 3, "Math.abs(-3) = " + tmp);
tmp = Math.abs(true);
ok(tmp === 1, "Math.abs(true) = " + tmp);
tmp = Math.abs();
ok(isNaN(tmp), "Math.abs() is not NaN");
tmp = Math.abs(NaN);
ok(isNaN(tmp), "Math.abs() is not NaN");
tmp = Math.abs(-Infinity);
ok(tmp === Infinity, "Math.abs(-Infinite) = " + tmp);
tmp = Math.abs(-3, 2);
ok(tmp === 3, "Math.abs(-3, 2) = " + tmp);