|
22 | 22 | #include <array> |
23 | 23 | #include <span> |
24 | 24 |
|
| 25 | +#include <fmt/format.h> |
| 26 | +#include "zmij.h" |
25 | 27 | #include "cpp/common/traits.hpp" // Teju Jagua |
26 | 28 | #include "PrintFloat.h" // Dragon4 |
27 | 29 | #include "double-conversion/double-conversion.h" |
@@ -354,6 +356,11 @@ int ryu(T d, std::span<char>& buffer) { |
354 | 356 | return d2s_buffered_n(d, buffer.data()); |
355 | 357 | } |
356 | 358 |
|
| 359 | +template<arithmetic_float T> |
| 360 | +int zmij(T d, std::span<char>& buffer) { |
| 361 | + return zmij::write(buffer.data(), buffer.size(), d); |
| 362 | +} |
| 363 | + |
357 | 364 | template<arithmetic_float T> |
358 | 365 | int teju_jagua(T d, std::span<char>& buffer) { |
359 | 366 | const auto fields = teju::traits_t<T>::teju(d); |
@@ -619,6 +626,7 @@ std::vector<BenchArgs<T>> initArgs(bool use_errol = false, size_t repeat = 0, si |
619 | 626 | args.emplace_back("double_conversion" , wrap(s::double_conversion<T>) , true); |
620 | 627 | args.emplace_back("swiftDtoa" , wrap(s::swiftDtoa<T>) , SWIFT_LIB_SUPPORTED); |
621 | 628 | args.emplace_back("yy_double" , wrap(s::yy_double<T>) , YY_DOUBLE_SUPPORTED && std::is_same_v<T, double>); |
| 629 | + args.emplace_back("zmij 1.0" , wrap(s::zmij<T>) , true); |
622 | 630 | args.emplace_back("std::to_chars" , wrap(s::std_to_chars<T>) , TO_CHARS_SUPPORTED); |
623 | 631 | // to_string, snprintf and abseil do not support shortest-length representation |
624 | 632 | // grisu2 does not round-trip correctly |
|
0 commit comments