Commit db737291 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Get rid of num_set_nan hack.

parent d0a719a7
......@@ -1987,7 +1987,7 @@ static HRESULT Date_getYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
t = local_time(date->time, date);
if(isnan(t)) {
if(retv)
num_set_nan(retv);
num_set_val(retv, NAN);
return S_OK;
}
......@@ -2023,7 +2023,7 @@ static HRESULT Date_setYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
if(isnan(year)) {
date->time = year;
if(retv)
num_set_nan(retv);
num_set_val(retv, NAN);
return S_OK;
}
......@@ -2414,7 +2414,7 @@ static HRESULT DateConstr_parse(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if(!arg_cnt(dp)) {
if(retv)
num_set_nan(retv);
num_set_val(retv, NAN);
return S_OK;
}
......
......@@ -456,7 +456,7 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
HRESULT hres;
if(!arg_cnt(dp)) {
if(retv) num_set_nan(retv);
if(retv) num_set_val(retv, NAN);
return S_OK;
}
......@@ -468,7 +468,7 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if(radix && (radix < 2 || radix > 36)) {
WARN("radix %d out of range\n", radix);
if(retv)
num_set_nan(retv);
num_set_val(retv, NAN);
return S_OK;
}
}
......@@ -537,7 +537,7 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
if(!arg_cnt(dp)) {
if(retv)
num_set_nan(retv);
num_set_val(retv, NAN);
return S_OK;
}
......@@ -616,7 +616,7 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
if(ret_nan) {
if(retv)
num_set_nan(retv);
num_set_val(retv, NAN);
return S_OK;
}
......@@ -1284,7 +1284,7 @@ HRESULT init_global(script_ctx_t *ctx)
if(FAILED(hres))
return hres;
num_set_nan(&var);
num_set_val(&var, NAN);
hres = jsdisp_propput_name(ctx->global, NaNW, &var, NULL/*FIXME*/);
if(FAILED(hres))
return hres;
......
......@@ -435,16 +435,6 @@ 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
}
static inline void num_set_inf(VARIANT *v, BOOL positive)
{
V_VT(v) = VT_R8;
......
......@@ -68,7 +68,7 @@ static HRESULT Math_abs(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA
if(!arg_cnt(dp)) {
if(retv)
num_set_nan(retv);
num_set_val(retv, NAN);
return S_OK;
}
......@@ -90,7 +90,7 @@ static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR
TRACE("\n");
if(!arg_cnt(dp)) {
if(retv) num_set_nan(retv);
if(retv) num_set_val(retv, NAN);
return S_OK;
}
......@@ -98,12 +98,8 @@ static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR
if(FAILED(hres))
return hres;
if(retv) {
if(x < -1.0 || x > 1.0)
num_set_nan(retv);
else
num_set_val(retv, acos(x));
}
if(retv)
num_set_val(retv, x < -1.0 || x > 1.0 ? NAN : acos(x));
return S_OK;
}
......@@ -116,7 +112,7 @@ static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR
TRACE("\n");
if(!arg_cnt(dp)) {
if(retv) num_set_nan(retv);
if(retv) num_set_val(retv, NAN);
return S_OK;
}
......@@ -124,12 +120,8 @@ static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR
if(FAILED(hres))
return hres;
if(retv) {
if(x < -1.0 || x > 1.0)
num_set_nan(retv);
else
num_set_val(retv, asin(x));
}
if(retv)
num_set_val(retv, x < -1.0 || x > 1.0 ? NAN : asin(x));
return S_OK;
}
......@@ -142,7 +134,7 @@ static HRESULT Math_atan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR
TRACE("\n");
if(!arg_cnt(dp)) {
if(retv) num_set_nan(retv);
if(retv) num_set_val(retv, NAN);
return S_OK;
}
......@@ -163,7 +155,7 @@ static HRESULT Math_atan2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPA
TRACE("\n");
if(arg_cnt(dp)<2) {
if(retv) num_set_nan(retv);
if(retv) num_set_val(retv, NAN);
return S_OK;
}
......@@ -190,7 +182,7 @@ static HRESULT Math_ceil(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR
if(!arg_cnt(dp)) {
if(retv)
num_set_nan(retv);
num_set_val(retv, NAN);
return S_OK;
}
......@@ -212,7 +204,7 @@ static HRESULT Math_cos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA
TRACE("\n");
if(!arg_cnt(dp)) {
if(retv) num_set_nan(retv);
if(retv) num_set_val(retv, NAN);
return S_OK;
}
......@@ -233,7 +225,7 @@ static HRESULT Math_exp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA
TRACE("\n");
if(!arg_cnt(dp)) {
if(retv) num_set_nan(retv);
if(retv) num_set_val(retv, NAN);
return S_OK;
}
......@@ -255,7 +247,7 @@ static HRESULT Math_floor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPA
if(!arg_cnt(dp)) {
if(retv)
num_set_nan(retv);
num_set_val(retv, NAN);
return S_OK;
}
......@@ -278,7 +270,7 @@ static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA
if(!arg_cnt(dp)) {
if(retv)
num_set_nan(retv);
num_set_val(retv, NAN);
return S_OK;
}
......@@ -286,12 +278,8 @@ static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA
if(FAILED(hres))
return hres;
if(retv) {
if(x < -0.0)
num_set_nan(retv);
else
num_set_val(retv, log(x));
}
if(retv)
num_set_val(retv, x < -0.0 ? NAN : log(x));
return S_OK;
}
......@@ -373,7 +361,7 @@ static HRESULT Math_pow(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA
TRACE("\n");
if(arg_cnt(dp) < 2) {
if(retv) num_set_nan(retv);
if(retv) num_set_val(retv, NAN);
return S_OK;
}
......@@ -417,7 +405,8 @@ static HRESULT Math_round(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPA
TRACE("\n");
if(!arg_cnt(dp)) {
num_set_nan(retv);
if(retv)
num_set_val(retv, NAN);
return S_OK;
}
......@@ -439,7 +428,7 @@ static HRESULT Math_sin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA
TRACE("\n");
if(!arg_cnt(dp)) {
if(retv) num_set_nan(retv);
if(retv) num_set_val(retv, NAN);
return S_OK;
}
......@@ -460,7 +449,7 @@ static HRESULT Math_sqrt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR
TRACE("\n");
if(!arg_cnt(dp)) {
if(retv) num_set_nan(retv);
if(retv) num_set_val(retv, NAN);
return S_OK;
}
......@@ -481,7 +470,7 @@ static HRESULT Math_tan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA
TRACE("\n");
if(!arg_cnt(dp)) {
if(retv) num_set_nan(retv);
if(retv) num_set_val(retv, NAN);
return S_OK;
}
......
......@@ -16,6 +16,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include "jscript.h"
#include "wine/debug.h"
......@@ -358,7 +361,7 @@ static HRESULT String_charCodeAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if(!is_int32(d) || d < 0 || d >= length) {
SysFreeString(val_str);
if(retv)
num_set_nan(retv);
num_set_val(retv, NAN);
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