jscript: Make parsing of double more accurate.
This commit is contained in:
parent
6aafd2f1de
commit
b81e44f8d9
|
@ -621,7 +621,9 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
|
|||
}
|
||||
|
||||
V_VT(retv) = VT_R8;
|
||||
V_R8(retv) = (double)(positive?d:-d)*pow(10, exp);
|
||||
if(!positive)
|
||||
d = -d;
|
||||
V_R8(retv) = (exp>0 ? d*pow(10, exp) : d/pow(10, -exp));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -474,7 +474,7 @@ static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **li
|
|||
else exp += e;
|
||||
}
|
||||
|
||||
*literal = new_double_literal(ctx, (DOUBLE)d*pow(10, exp));
|
||||
*literal = new_double_literal(ctx, exp>=0 ? d*pow(10, exp) : d/pow(10, -exp));
|
||||
return tNumericLiteral;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue