3232#include " ryu/ryu.h"
3333#include " schubfach_32.h"
3434#include " schubfach_64.h"
35+ #if (__SIZEOF_INT128__ == 16) && (defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER))
3536#include " yy_double.h"
36-
37+ #define YY_DOUBLE_SUPPORTED 1
38+ #else
39+ #define YY_DOUBLE_SUPPORTED 0
40+ #endif
3741namespace Benchmarks {
3842
3943enum Algorithm {
@@ -54,7 +58,7 @@ enum Algorithm {
5458 STD_TO_CHARS = 14 ,
5559 GRISU3 = 15 ,
5660 YY_DOUBLE = 16 ,
57- COUNT = 17 ,
61+ COUNT // Keep last
5862};
5963
6064template <typename T>
@@ -95,6 +99,7 @@ int errol3(T d, std::span<char>& buffer) {
9599 errol3_dtoa (d, buffer.data ()); // returns the exponent
96100 return std::strlen (buffer.data ());
97101#else
102+ std::cerr << " errol3 not supported" << std::endl;
98103 std::abort ();
99104#endif
100105}
@@ -153,6 +158,7 @@ int netlib(T d, std::span<char>& buffer) {
153158 std::abort ();
154159 }
155160#else
161+ std::cerr << " netlib not supported" << std::endl;
156162 std::abort ();
157163#endif
158164}
@@ -227,11 +233,15 @@ int double_conversion(T d, std::span<char>& buffer) {
227233 return strlen (builder.Finalize ());
228234}
229235
230- // No yy_float implementation
231236template <arithmetic_float T>
232237int yy_double (T d, std::span<char >& buffer) {
238+ #if YY_DOUBLE_SUPPORTED
233239 const char * end_ptr = yy_double_to_string (d, buffer.data ());
234240 return end_ptr - buffer.data ();
241+ #else
242+ std::cerr << " yy_double not supported" << std::endl;
243+ std::abort ();
244+ #endif
235245}
236246
237247template <arithmetic_float T>
@@ -255,6 +265,7 @@ int std_to_chars(T d, std::span<char>& buffer) {
255265 }
256266 return p - buffer.data ();
257267#else
268+ std::cerr << " std::to_chars not supported" << std::endl;
258269 std::abort ();
259270#endif
260271}
0 commit comments