Fixed frequency pretty print function

This commit is contained in:
Mark Qvist 2023-09-30 19:18:30 +02:00
parent 4fa616a326
commit 2d2f0947ac

View File

@ -188,7 +188,7 @@ def prettyfrequency(hz, suffix="Hz"):
for unit in units: for unit in units:
if abs(num) < 1000.0: if abs(num) < 1000.0:
if unit == "": if unit == "":
return "%.0f %s%s" % (num, unit, suffix) return "%.2f %s%s" % (num, unit, suffix)
else: else:
return "%.2f %s%s" % (num, unit, suffix) return "%.2f %s%s" % (num, unit, suffix)
num /= 1000.0 num /= 1000.0