summaryrefslogtreecommitdiffstatshomepage
path: root/tests/float/float_parse_doubleprec.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-02-26 15:54:03 +1100
committerDamien George <damien.p.george@gmail.com>2018-02-26 15:54:03 +1100
commit6dad0885692f8d1e743873fb4be241f1fd1cb91a (patch)
tree95f113be83bd93e68bfb5c04da7ef9bde034cbf1 /tests/float/float_parse_doubleprec.py
parent4c2230add8bbc40a0c86327c5e21ba10f78623b9 (diff)
downloadmicropython-6dad0885692f8d1e743873fb4be241f1fd1cb91a.tar.gz
micropython-6dad0885692f8d1e743873fb4be241f1fd1cb91a.zip
tests/float: Adjust float-parsing tests to pass with only a small error.
Float parsing (both single and double precision) may have a relative error of order the floating point precision, so adjust tests to take this into account by not printing all of the digits of the answer.
Diffstat (limited to 'tests/float/float_parse_doubleprec.py')
-rw-r--r--tests/float/float_parse_doubleprec.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/float/float_parse_doubleprec.py b/tests/float/float_parse_doubleprec.py
index 2ea7842f3f..dcc0dd5921 100644
--- a/tests/float/float_parse_doubleprec.py
+++ b/tests/float/float_parse_doubleprec.py
@@ -11,9 +11,9 @@ print(float('.' + '9' * 400 + 'e100'))
print(float('.' + '9' * 400 + 'e-100'))
# tiny fraction with large exponent
-print(float('.' + '0' * 400 + '9e100'))
-print(float('.' + '0' * 400 + '9e200'))
-print(float('.' + '0' * 400 + '9e400'))
+print('%.14e' % float('.' + '0' * 400 + '9e100'))
+print('%.14e' % float('.' + '0' * 400 + '9e200'))
+print('%.14e' % float('.' + '0' * 400 + '9e400'))
# ensure that accuracy is retained when value is close to a subnormal
print(float('1.00000000000000000000e-307'))