|
20 | 20 | #include "grisu_exact.h" |
21 | 21 | #include "dragon4.h" |
22 | 22 | #include "schubfach_64.h" |
| 23 | +#include "errol.h" |
23 | 24 |
|
24 | 25 | #define IEEE_8087 |
25 | 26 | #include "benchutil.h" |
@@ -67,6 +68,16 @@ void process(std::vector<double> &lines) { |
67 | 68 | return volume; |
68 | 69 | }); |
69 | 70 |
|
| 71 | + pretty_print(lines, "errol3", [](const std::vector<double> &lines) { |
| 72 | + double volume = 0; |
| 73 | + char buffer[100]; |
| 74 | + for (const auto d : lines) { |
| 75 | + errol3_dtoa(d, buffer); // returns the exponent? |
| 76 | + volume += std::strlen(buffer); |
| 77 | + } |
| 78 | + return volume; |
| 79 | + }); |
| 80 | + |
70 | 81 | pretty_print(lines, "std::to_string", [](const std::vector<double> &lines) { |
71 | 82 | double volume = 0; |
72 | 83 | for (const auto d : lines) { |
@@ -136,24 +147,6 @@ void process(std::vector<double> &lines) { |
136 | 147 | return volume; |
137 | 148 | }); |
138 | 149 |
|
139 | | -#if FROM_CHARS_DOUBLE_SUPPORTED |
140 | | - pretty_print(lines, "std::to_chars", [](const std::vector<double> &lines) { |
141 | | - double volume = 0; |
142 | | - char buffer[100]; |
143 | | - for (const auto d : lines) { |
144 | | - const auto [p, ec] = std::to_chars(buffer, buffer + sizeof(buffer), d); |
145 | | - if(ec != std::errc()) { |
146 | | - std::cerr << "problem with " << d << std::endl; |
147 | | - std::abort(); |
148 | | - } |
149 | | - volume += p - buffer; |
150 | | - } |
151 | | - return volume; |
152 | | - }); |
153 | | -#else |
154 | | - std::cout << "# std::to_chars not supported" << std::endl; |
155 | | -#endif |
156 | | - |
157 | 150 | pretty_print(lines, "schubfach", [](const std::vector<double> &lines) { |
158 | 151 | double volume = 0; |
159 | 152 | char buffer[100]; |
@@ -224,6 +217,26 @@ void process(std::vector<double> &lines) { |
224 | 217 | } |
225 | 218 | return volume; |
226 | 219 | }); |
| 220 | + |
| 221 | + |
| 222 | +#if FROM_CHARS_DOUBLE_SUPPORTED |
| 223 | + pretty_print(lines, "std::to_chars", [](const std::vector<double> &lines) { |
| 224 | + double volume = 0; |
| 225 | + char buffer[100]; |
| 226 | + for (const auto d : lines) { |
| 227 | + const auto [p, ec] = std::to_chars(buffer, buffer + sizeof(buffer), d); |
| 228 | + if(ec != std::errc()) { |
| 229 | + std::cerr << "problem with " << d << std::endl; |
| 230 | + std::abort(); |
| 231 | + } |
| 232 | + volume += p - buffer; |
| 233 | + } |
| 234 | + return volume; |
| 235 | + }); |
| 236 | +#else |
| 237 | + std::cout << "# std::to_chars not supported" << std::endl; |
| 238 | +#endif |
| 239 | + |
227 | 240 | } |
228 | 241 |
|
229 | 242 | void fileload(const char *filename) { |
|
0 commit comments