diff options
author | Gary Bressler <garybressler@nc.rr.com> | 2010-03-01 23:46:44 -0500 |
---|---|---|
committer | Gary Bressler <garybressler@nc.rr.com> | 2010-03-01 23:46:44 -0500 |
commit | 44a8ade3ed5dc4810fd95c41dbe8ec3aa2fb0cf7 (patch) | |
tree | 4275bbcb03ec58412c3703e4df68f43fb1c10089 /viz/util.py |
Reorganized tree, along with the visualizer
Diffstat (limited to 'viz/util.py')
-rw-r--r-- | viz/util.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/viz/util.py b/viz/util.py new file mode 100644 index 0000000..3111f39 --- /dev/null +++ b/viz/util.py | |||
@@ -0,0 +1,9 @@ | |||
1 | #!/usr/bin/python | ||
2 | |||
3 | """Miscellanious utility functions that don't fit anywhere.""" | ||
4 | |||
5 | def format_float(num, numplaces): | ||
6 | if abs(round(num, numplaces) - round(num, 0)) == 0.0: | ||
7 | return '%.0f' % float(num) | ||
8 | else: | ||
9 | return ('%.' + numplaces + 'f') % round(float(num), numplaces) | ||