[pypy-svn] r65169 - pypy/branch/js-refactoring/pypy/lang/js

jandem at codespeak.net jandem at codespeak.net
Fri May 8 22:00:36 CEST 2009


Author: jandem
Date: Fri May  8 22:00:33 2009
New Revision: 65169

Modified:
   pypy/branch/js-refactoring/pypy/lang/js/jsobj.py
Log:
Fix float-to-string for large values, fixes some array tests


Modified: pypy/branch/js-refactoring/pypy/lang/js/jsobj.py
==============================================================================
--- pypy/branch/js-refactoring/pypy/lang/js/jsobj.py	(original)
+++ pypy/branch/js-refactoring/pypy/lang/js/jsobj.py	Fri May  8 22:00:33 2009
@@ -1,6 +1,6 @@
 # encoding: utf-8
 from pypy.rlib.rarithmetic import r_uint, intmask, isnan, isinf,\
-     ovfcheck_float_to_int, NAN
+     ovfcheck_float_to_int, NAN, formatd_overflow
 from pypy.lang.js.execution import ThrowException, JsTypeError,\
      RangeError, ReturnException
 DE = 1
@@ -488,13 +488,9 @@
             else:
                 return '-Infinity'
         try:
-            intval = ovfcheck_float_to_int(self.floatval)
-            if intval == self.floatval:
-                return str(intval)
+            res = formatd_overflow('', 10, 'g', self.floatval)
         except OverflowError:
-            pass
-
-        res = str(self.floatval)
+            raise
         if (res[-3] == '+' or res[-3] == '-') and res[-2] == '0':
             cut = len(res) - 2
             assert cut >= 0



More information about the Pypy-commit mailing list