Attempt to Add float16_t support#123
Conversation
Your #include is inside a #include in namespaces is not allowed, move it outside. You'll most likely need to duplicate that #ifdef, a namespace zmij {, or something. |
|
I swear I had tried that initially and seen the same error. Apologies for wasting your time. |
float16_t supportfloat16_t support
|
I have made some progress now. I have added enough P.S. One definite issue is that I'm getting bad information from |
vitaut
left a comment
There was a problem hiding this comment.
Thanks for the PR. Please revert any unrelated changes such as commenting out sse tests.
|
Sorry - I should have made it clearer that:
|
|
I'm also very interested in float16-to-string conversion. But I'm wondering whether we can avoid using |
Let's first make |
|
@vitaut A better explanation: The SSE tests are commented out because:
What is the correct way to disable SIMD for both zmij and the tests? |
| }; | ||
|
|
||
| #ifdef __STDCPP_FLOAT16_T__ | ||
| template <> struct float_traits<std::float16_t> : std::numeric_limits<std::float16_t> { |
There was a problem hiding this comment.
You shouldn't be adding a new trait but update the main trait to handle 16-bit float correctly (mostly num_bits).
In your local build you can set |
| auto to_decimal(double value) noexcept -> dec_fp; | ||
|
|
||
| enum { | ||
| half_buffer_size = 9, |
|
I have rebased and rewritten this incorporating your requests. It still gives incorrect output. I think the key issue is here: https://github.com/vitaut/zmij/blob/main/zmij.cc#L1063 I assume this needs an extra special case for 16 bits, but I don't know which constants then need changing. Any pointers much appreciated. |
I think the code you were referring to has moved. Use a permalink to prevent this. |
Yes, it has moved up slightly: Line 975 in f1126cd (This is a block that checks for 32 bits) |
|
That particular check could be changed to |
Hello,
As discussed here fmtlib/fmt#4725 I need to format
float16_ts. I started trying to work on this today, but have failed early on.I am working with GCC 15.2 (Clang does not have
stdfloatsupport yet). I have changedCMakeLists.txtto compile in C++23 mode. I then started to addfloat16_toverloads. However, if I compile with the set of changes in this MR I get:This doesn't make any sense to me - any ideas are most welcome.
(I have checked that a simple test
float16_tprogram not using zmij compiles correctly on my setup).