Don't round then pass to print, round using printf formatting

This commit is contained in:
Matt Martz 2013-02-11 16:19:22 -06:00
parent 0408443fb6
commit 4223b7e822
2 changed files with 4 additions and 4 deletions

View File

@ -345,7 +345,7 @@ def speedtest():
dlspeed = downloadSpeed(urls, args.simple)
if not args.simple:
print
print 'Download: %s Mbit/s' % round((dlspeed / 1024 / 1024) * 8, 2)
print 'Download: %0.2f Mbit/s' % ((dlspeed / 1024 / 1024) * 8)
sizesizes = [int(.25 * 1024 * 1024), int(.5 * 1024 * 1024)]
sizes = []
@ -357,7 +357,7 @@ def speedtest():
ulspeed = uploadSpeed(best['url'], sizes, args.simple)
if not args.simple:
print
print 'Upload: %s Mbit/s' % round((ulspeed / 1024 / 1024) * 8, 2)
print 'Upload: %0.2f Mbit/s' % ((ulspeed / 1024 / 1024) * 8)
if args.share:
dlspeedk = int(round((dlspeed / 1024) * 8, 0))

View File

@ -324,7 +324,7 @@ def speedtest():
dlspeed = downloadSpeed(urls, args.simple)
if not args.simple:
print()
print('Download: %s Mbit/s' % round((dlspeed / 1024 / 1024) * 8, 2))
print('Download: %0.2f Mbit/s' % ((dlspeed / 1024 / 1024) * 8))
sizesizes = [int(.25 * 1024 * 1024), int(.5 * 1024 * 1024)]
sizes = []
@ -336,7 +336,7 @@ def speedtest():
ulspeed = uploadSpeed(best['url'], sizes, args.simple)
if not args.simple:
print()
print('Upload: %s Mbit/s' % round((ulspeed / 1024 / 1024) * 8, 2))
print('Upload: %0.2f Mbit/s' % ((ulspeed / 1024 / 1024) * 8))
if args.share:
dlspeedk = int(round((dlspeed / 1024) * 8, 0))