diff options
author | Mac Mollison <mollison@cs.unc.edu> | 2010-03-13 12:12:37 -0500 |
---|---|---|
committer | Mac Mollison <mollison@cs.unc.edu> | 2010-03-13 12:12:37 -0500 |
commit | 122f457226f54ad23b7cd138512502e430e704dc (patch) | |
tree | fee0690936c3ae95255e559cd0fd09f0fa8c2ad4 /unit_trace/viz/util.py | |
parent | 14a40b99735f09f6e70b8e897acbb622f9115ca3 (diff) |
Further restructuring to create 'unit_trace' pkg
The unit_trace folder should be placed in
/usr/local/lib/pythonX.Y/site-packages.
This makes unit-trace submodules available from anywhere
on the system.
Diffstat (limited to 'unit_trace/viz/util.py')
-rw-r--r-- | unit_trace/viz/util.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/unit_trace/viz/util.py b/unit_trace/viz/util.py new file mode 100644 index 0000000..3111f39 --- /dev/null +++ b/unit_trace/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) | ||