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.
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user