There is no point in displaying a mean value of several thousand with two digits after the decimal. Hence, this function formats a float without quite so much precision.
If the number is over 100, we drop the fraction altogether.
If the number has two digits to the left of the decimal, we use one to the right.
With smaller numbers, two digits after the decimal should be plenty.
# - - - s t a t N u m b e r
def statNumber(x):
'''Display x without too much precision.
'''
if x > 100.0: format = '%.0f'
elif x > 10.0: format = '%.1f'
else: format = '%.2f'
return format % x