internal method used to format doubles as strings
| 100 | |
| 101 | // internal method used to format doubles as strings |
| 102 | std::string formatString(double t_d, unsigned t_prec) { |
| 103 | std::stringstream ss; |
| 104 | ss << std::setprecision(t_prec) << std::noshowpoint << std::fixed << t_d; |
| 105 | std::string s = ss.str(); |
| 106 | |
| 107 | /* |
| 108 | // truncate 0's from the end |
| 109 | int i = s.size() - 1; |
| 110 | while (i > 0 && s[i] == '0') |
| 111 | { |
| 112 | --i; |
| 113 | } |
| 114 | |
| 115 | if (i > 0) |
| 116 | { |
| 117 | s.erase(i + 1); |
| 118 | |
| 119 | if (*s.rbegin() == '.') |
| 120 | { |
| 121 | s.push_back('0'); |
| 122 | } |
| 123 | } |
| 124 | */ |
| 125 | |
| 126 | return s; |
| 127 | } |
| 128 | |
| 129 | // internal method used to format all other types as strings |
| 130 | template <typename T> |