On top of what Jonathan said, Teju Jagua yields a smaller binary size since it needs fewer look-up tables.
Regarding performance and correctness: 1) My patch passes all the tests. 2) The GitHub project of the reference implementation (*) scans all floats and the results of Teju Jagua, Ryu and Dragonbox match. 3) The project (*) benchmarks ran on my PC show performance improvements. For doubles, Teju Jagua 98% faster than Ryu. For floats the speed up is about 50%. I'll provide easier to run benchmark programs for, potentially, being added to gcc's repo. 4) I have notes proving the mathematical correctness of the algorithm which I will turn into a paper to be uploaded to the arxiv and submitted to a peer-reviewed journal. (*) I'll soon document the project for others to run tests and benchmarks. Best regards, Cassio. On Tue, 6 Aug 2024, 18:10 Jonathan Wakely, <jwakely....@gmail.com> wrote: > > > On Tue, 6 Aug 2024, 17:28 Andi Kleen, <a...@linux.intel.com> wrote: > >> Cassio Neri <cassio.n...@gmail.com> writes: >> >> > Implement the template function teju_jagua which finds the shortest >> > representation of a floating-point number. The floating-point type is a >> > template parameter and the implementation is generic enough to handle >> all >> > floating-point types of interest, namely, IEEE 754, std::bfloat16_t, >> > x86 80-bit and IBM128. >> >> So the only benefit is performance, right? > > > The functions should be as fast as possible. > > The algorithm is also simpler though. > > So the patch >> should come with some performance numbers how it is better >> than the old code. Also how did you validate that it works >> correctly? >> > > See the talks linked to in > https://gcc.gnu.org/pipermail/gcc-patches/2024-August/659362.html > > > >> -Andi >> >>