Commit 45aee4fd authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Fixed some math API assumption that cause test failures on Solaris.

parent 9a16f796
......@@ -290,7 +290,7 @@ static HRESULT JSGlobal_escape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D
for(ptr=str; *ptr; ptr++) {
if(*ptr > 0xff)
len += 6;
else if(isalnum((char)*ptr) || *ptr=='*' || *ptr=='@' || *ptr=='-'
else if(isalnum((unsigned char)*ptr) || *ptr=='*' || *ptr=='@' || *ptr=='-'
|| *ptr=='_' || *ptr=='+' || *ptr=='.' || *ptr=='/')
len++;
else
......
......@@ -100,7 +100,13 @@ static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR
if(FAILED(hres))
return hres;
if(retv) num_set_val(retv, acos(num_val(&v)));
if(retv) {
DOUBLE x = num_val(&v);
if(x < -1.0 || x > 1.0)
num_set_nan(retv);
else
num_set_val(retv, acos(x));
}
return S_OK;
}
......@@ -121,7 +127,13 @@ static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR
if(FAILED(hres))
return hres;
if(retv) num_set_val(retv, asin(num_val(&v)));
if(retv) {
DOUBLE x = num_val(&v);
if(x < -1.0 || x > 1.0)
num_set_nan(retv);
else
num_set_val(retv, asin(x));
}
return S_OK;
}
......@@ -278,8 +290,13 @@ static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA
if(FAILED(hres))
return hres;
if(retv)
num_set_val(retv, log(num_val(&v)));
if(retv) {
DOUBLE x = num_val(&v);
if(x < -0.0)
num_set_nan(retv);
else
num_set_val(retv, log(x));
}
return S_OK;
}
......
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