mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 11:40:18 +01:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user