Class to format numbers in an engineering-type form. More...
#include <DwmEngFormat.hh>
Friends | |
| std::ostream & | operator<< (std::ostream &os, const EngFormat &ef) |
Class to format numbers in an engineering-type form.
Instead of printing numerical powers of 10, we print 'K' (kilo), 'M' (mega), 'm' (milli), 'u' (micro), et. al.
Example:
uint32_t v = 123456; std::cout << Dwm::EngFormat(v) << std::endl;
would print:
123.5K
precision is the maximum precision (places including those to the left of the decimal point) to print. width is the minimum field width to print; we right-justify and fill with spaces.