jscript: Make parsing of double more accurate.

This commit is contained in:
Piotr Caban 2012-04-19 15:28:30 +02:00 committed by Alexandre Julliard
parent 6aafd2f1de
commit b81e44f8d9
2 changed files with 4 additions and 2 deletions

View File

@ -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;
}

View File

@ -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;
}