From b81e44f8d975013a1039772fcfb228488335ff55 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Thu, 19 Apr 2012 15:28:30 +0200 Subject: [PATCH] jscript: Make parsing of double more accurate. --- dlls/jscript/global.c | 4 +++- dlls/jscript/lex.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/jscript/global.c b/dlls/jscript/global.c index 13b2cc9676a..92c70bcd652 100644 --- a/dlls/jscript/global.c +++ b/dlls/jscript/global.c @@ -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; } diff --git a/dlls/jscript/lex.c b/dlls/jscript/lex.c index 3bb2814aadb..42e482f28e9 100644 --- a/dlls/jscript/lex.c +++ b/dlls/jscript/lex.c @@ -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; }