# test float formatting# general roundingfor val in (116, 1111, 1234, 5010, 11111):print('%.0f' % val)print('%.1f' % val)print('%.3f' % val)# make sure rounding is done at the correct precisionfor prec in range(8):print(('%%.%df' % prec) % 6e-5)# check certain cases that had a digit value of 10 render as a ":" characterprint('%.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 charactersfloat('%.23e' % 1e-80)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。