diff options
author | Damien George <damien.p.george@gmail.com> | 2018-02-26 15:54:03 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-02-26 15:54:03 +1100 |
commit | 6dad0885692f8d1e743873fb4be241f1fd1cb91a (patch) | |
tree | 95f113be83bd93e68bfb5c04da7ef9bde034cbf1 /tests/float/float_parse.py | |
parent | 4c2230add8bbc40a0c86327c5e21ba10f78623b9 (diff) | |
download | micropython-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.py')
-rw-r--r-- | tests/float/float_parse.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/float/float_parse.py b/tests/float/float_parse.py index de4ea455fb..5eb16e79cf 100644 --- a/tests/float/float_parse.py +++ b/tests/float/float_parse.py @@ -7,9 +7,8 @@ print(float('1234') - float('0.1234e4')) print(float('1.015625') - float('1015625e-6')) # very large integer part with a very negative exponent should cancel out -print(float('9' * 60 + 'e-60')) -print(float('9' * 60 + 'e-40')) -print(float('9' * 60 + 'e-20') == float('1e40')) +print('%.4e' % float('9' * 60 + 'e-60')) +print('%.4e' % float('9' * 60 + 'e-40')) # many fractional digits print(float('.' + '9' * 70)) |