summaryrefslogtreecommitdiff
path: root/tools.py
diff options
context:
space:
mode:
authorAnthony LaTorre <tlatorre9@gmail.com>2011-09-10 17:20:49 -0400
committerAnthony LaTorre <tlatorre9@gmail.com>2011-09-10 17:20:49 -0400
commit73769dcb8667b855b95d183322214331b0c11dd0 (patch)
tree6ae090d0a8f47ad4a4e361d9388cea2bdb174263 /tools.py
parente19f8046b479790a9b5f8feedf8a13678f75d350 (diff)
downloadchroma-73769dcb8667b855b95d183322214331b0c11dd0.tar.gz
chroma-73769dcb8667b855b95d183322214331b0c11dd0.tar.bz2
chroma-73769dcb8667b855b95d183322214331b0c11dd0.zip
round value and uncertainty in ufloat_to_str().
Diffstat (limited to 'tools.py')
-rw-r--r--tools.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools.py b/tools.py
index a884db3..1840fae 100644
--- a/tools.py
+++ b/tools.py
@@ -6,7 +6,8 @@ import math
def ufloat_to_str(x):
msd = -int(math.floor(math.log10(x.std_dev())))
- return '%.*f +/- %.*f' % (msd, x.nominal_value, msd, x.std_dev())
+ return '%.*f +/- %.*f' % (msd, round(x.nominal_value, msd),
+ msd, round(x.std_dev(), msd))
def progress(seq):
"Print progress while iterating over `seq`."