[pypy-svn] r13800 - in pypy/dist/pypy/objspace/std: . test
arigo at codespeak.net
arigo at codespeak.net
Fri Jun 24 15:36:36 CEST 2005
Author: arigo
Date: Fri Jun 24 15:36:36 2005
New Revision: 13800
Modified:
pypy/dist/pypy/objspace/std/strutil.py
pypy/dist/pypy/objspace/std/test/test_strutil.py
Log:
Oups, a test that appears to hang (in fact it only runs for an incredibly long time)...
Modified: pypy/dist/pypy/objspace/std/strutil.py
==============================================================================
--- pypy/dist/pypy/objspace/std/strutil.py (original)
+++ pypy/dist/pypy/objspace/std/strutil.py Fri Jun 24 15:36:36 2005
@@ -217,20 +217,23 @@
e = string_to_int(exponent)
except ParseStringOverflowError:
if exponent[0] == '-':
- return 0.0
+ e = -400
else:
- if sign == '-':
- return -1e200 * 1e200
- else:
- return 1e200 * 1e200
+ e = 400
if e > 0:
- while e > 0:
- r *= 10.0
- e -= 1
+ if e >= 400:
+ r = 1e200 * 1e200
+ else:
+ while e > 0:
+ r *= 10.0
+ e -= 1
else:
- while e < 0:
- r /= 10.0
- e += 1
+ if e <= -400:
+ r = 0.0
+ else:
+ while e < 0:
+ r /= 10.0
+ e += 1
if sign == '-':
r = -r
Modified: pypy/dist/pypy/objspace/std/test/test_strutil.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_strutil.py (original)
+++ pypy/dist/pypy/objspace/std/test/test_strutil.py Fri Jun 24 15:36:36 2005
@@ -159,6 +159,10 @@
assert string_to_float('1e-1111111111111') == float('1e-1111111111111')
assert string_to_float('-1e1111111111111') == float('-1e1111111111111')
assert string_to_float('-1e-1111111111111') == float('-1e-1111111111111')
+ assert string_to_float('1e111111111111111111111') == float('1e111111111111111111111')
+ assert string_to_float('1e-111111111111111111111') == float('1e-111111111111111111111')
+ assert string_to_float('-1e111111111111111111111') == float('-1e111111111111111111111')
+ assert string_to_float('-1e-111111111111111111111') == float('-1e-111111111111111111111')
valid_parts = [['', ' ', ' \f\n\r\t\v'],
['', '+', '-'],
More information about the Pypy-commit
mailing list