Piotr Caban : jscript: Make parsing of double more accurate.

Alexandre Julliard julliard at winehq.org
Thu Apr 19 13:27:52 CDT 2012


Module: wine
Branch: master
Commit: b81e44f8d975013a1039772fcfb228488335ff55
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b81e44f8d975013a1039772fcfb228488335ff55

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Apr 19 15:28:30 2012 +0200

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 13b2cc9..92c70bc 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 3bb2814..42e482f 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;
 }
 




More information about the wine-cvs mailing list