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>
@@ -92,6 +96,7 @@ int errol3(T d, std::span<char>& buffer) {
9296 errol3_dtoa (d, buffer.data ()); // returns the exponent
9397 return std::strlen (buffer.data ());
9498#else
99+ std::cerr << " errol3 not supported" << std::endl;
95100 std::abort ();
96101#endif
97102}
@@ -150,6 +155,7 @@ int netlib(T d, std::span<char>& buffer) {
150155 std::abort ();
151156 }
152157#else
158+ std::cerr << " netlib not supported" << std::endl;
153159 std::abort ();
154160#endif
155161}
@@ -224,11 +230,15 @@ int double_conversion(T d, std::span<char>& buffer) {
224230 return strlen (builder.Finalize ());
225231}
226232
227- // No yy_float implementation
228233template <arithmetic_float T>
229234int yy_double (T d, std::span<char >& buffer) {
235+ #if YY_DOUBLE_SUPPORTED
230236 const char * end_ptr = yy_double_to_string (d, buffer.data ());
231237 return end_ptr - buffer.data ();
238+ #else
239+ std::cerr << " yy_double not supported" << std::endl;
240+ std::abort ();
241+ #endif
232242}
233243
234244template <arithmetic_float T>
@@ -252,6 +262,7 @@ int std_to_chars(T d, std::span<char>& buffer) {
252262 }
253263 return p - buffer.data ();
254264#else
265+ std::cerr << " std::to_chars not supported" << std::endl;
255266 std::abort ();
256267#endif
257268}
0 commit comments