summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_strtod.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-06-20 18:50:19 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-06-20 18:50:19 (GMT)
commit801923681c6b03ea5f9ab916fa3fdd01335469ab (patch)
treefa89b6aea07dfb697ded7af42bd73bac55e75741 /Lib/test/test_strtod.py
parentc733b3252fae67fef7b6d89e1320fe7eb3023b3e (diff)
downloadcpython-801923681c6b03ea5f9ab916fa3fdd01335469ab.zip
cpython-801923681c6b03ea5f9ab916fa3fdd01335469ab.tar.gz
cpython-801923681c6b03ea5f9ab916fa3fdd01335469ab.tar.bz2
Merge test_strtod and test_float string-to-float conversion tests.
Diffstat (limited to 'Lib/test/test_strtod.py')
-rw-r--r--Lib/test/test_strtod.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_strtod.py b/Lib/test/test_strtod.py
index ea6b305..7bc595d 100644
--- a/Lib/test/test_strtod.py
+++ b/Lib/test/test_strtod.py
@@ -23,6 +23,8 @@ strtod_parser = re.compile(r""" # A numeric string consists of:
\Z
""", re.VERBOSE | re.IGNORECASE).match
+# Pure Python version of correctly rounded string->float conversion.
+# Avoids any use of floating-point by returning the result as a hex string.
def strtod(s, mant_dig=53, min_exp = -1021, max_exp = 1024):
"""Convert a finite decimal string to a hex string representing an
IEEE 754 binary64 float. Return 'inf' or '-inf' on overflow.
@@ -259,6 +261,10 @@ class StrtodTests(unittest.TestCase):
'18487398785991994634182916638542680759613590482273e-357',
'32002864200581033134358724675198044527469366773928e-358',
'94393431193180696942841837085033647913224148539854e-358',
+ '73608278998966969345824653500136787876436005957953e-358',
+ '64774478836417299491718435234611299336288082136054e-358',
+ '13704940134126574534878641876947980878824688451169e-357',
+ '46697445774047060960624497964425416610480524760471e-358',
# failing case for bug introduced by METD in r77451 (attempted
# fix for issue 7632, bug 2), and fixed in r77482.
'28639097178261763178489759107321392745108491825303e-311',