Skip to content

Commit 29a5135

Browse files
committed
add dragon4 algorithm to the benchmark
1 parent d295879 commit 29a5135

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

benchmarks/benchmark.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "ryu/ryu.h"
1919
#include "double-conversion/double-conversion.h"
2020
#include "grisu_exact.h"
21+
#include "dragon4.h"
2122

2223
#define IEEE_8087
2324
#include "benchutil.h"
@@ -51,6 +52,20 @@
5152
#endif
5253

5354
void process(std::vector<double> &lines) {
55+
pretty_print(lines, "dragon4", [](const std::vector<double> &lines) {
56+
double volume = 0;
57+
for (const auto d : lines) {
58+
uint64_t dmantissa;
59+
int dexp;
60+
const IEEE754d fields = decode_ieee754(d);
61+
dragon4::Dragon4(dmantissa, dexp, fields.mantissa, fields.exponent,
62+
true, true);
63+
char buffer[100];
64+
volume += to_chars(dmantissa, dexp, fields.sign, buffer);
65+
}
66+
return volume;
67+
});
68+
5469
pretty_print(lines, "std::to_string", [](const std::vector<double> &lines) {
5570
double volume = 0;
5671
for (const auto d : lines) {

0 commit comments

Comments
 (0)