summaryrefslogtreecommitdiff
path: root/tests/float/float_format.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-03-01 17:00:02 +1100
committerDamien George <damien.p.george@gmail.com>2018-03-01 17:00:02 +1100
commit955ee6477f4b1d3a70bfe97a1e7727848bf2d06d (patch)
tree195d1942743e669f25c77874e1bf69bf49ab6781 /tests/float/float_format.py
parent7b050fa76c6a763043739d40c82dde839d7f8fd9 (diff)
py/formatfloat: Fix case where floats could render with negative digits.
Prior to this patch, some architectures (eg unix x86) could render floats with "negative" digits, like ")". For example, '%.23e' % 1e-80 would come out as "1.0000000000000000/)/(,*0e-80". This patch fixes the known cases.
Diffstat (limited to 'tests/float/float_format.py')
-rw-r--r--tests/float/float_format.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/float/float_format.py b/tests/float/float_format.py
index cda395ce0..d43535cf2 100644
--- a/tests/float/float_format.py
+++ b/tests/float/float_format.py
@@ -13,3 +13,7 @@ for prec in range(8):
# check certain cases that had a digit value of 10 render as a ":" character
print('%.2e' % float('9' * 51 + 'e-39'))
print('%.2e' % float('9' * 40 + 'e-21'))
+
+# check a case that would render negative digit values, eg ")" characters
+# the string is converted back to a float to check for no illegal characters
+float('%.23e' % 1e-80)