ryu
ryu copied to clipboard
Converts floating point numbers to decimal strings
This is a very early draft for putting %g in ryu so that printf() writers will find it easier to use it. Current TODOs include: * [ ] tests (I...
Hi, I know there are several other issues open on this related topic, but I believe this would be slightly solution - hard fail please, This bit of code will...
There should be `#define` macros in rhu.h which specifies safe buffer lengths for the `buffered` functions.
See [Faster remainders when the divisor is a constant: beating compilers and libdivide](https://lemire.me/blog/2019/02/08/faster-remainders-when-the-divisor-is-a-constant-beating-compilers-and-libdivide/) and the paper [Faster Remainder by Direct Computation: Applications to Compilers and Software Libraries](https://arxiv.org/pdf/1902.01961.pdf) by Daniel Lemire,...
Local tests pass and I get a performance boost of ~6% for double to string conversion. It's difficult to pinpoint exactly what makes the performance better. Here are some clues....
The Java implementation sometimes doesn't output the closest two-digit representation of a number, but instead rounds to one digit (correctly), and then appends a '0'. Known examples: ```1.0E-323``` should be...
I noticed there are some differences in the constants from what the paper would suggest. For example, https://github.com/ulfjack/ryu/blob/5c361464cc8a42c99d61f3e7336ba6f9930cf905/ryu/d2s.h#L40-L41 whereas the paper suggests these should both be 124 (Figure 4). Why...
As hated as they are, manpages are still quite commonly used by \*nix programmers writing code. Given how semantic mdoc can be, it's not *that* painful to write and consume...
A very common usage pattern of such functions is the following ```c++ // the output buffer; could be another type, eg char* std::string s; // how large is enough? We...
It is easy to reproduce this in the unit tests: ```c++ // s2f_test.cc TEST(S2fTest, TrailingDecimalZeros) { EXPECT_S2F(1.f, "1"); EXPECT_S2F(1.f, "1.000"); EXPECT_S2F(1.f, "1.000000000"); // fail: INPUT_TOO_LONG EXPECT_S2F(8388605.f, "8388605"); EXPECT_S2F(8388605.f, "8388605.00"); EXPECT_S2F(8388605.f,...