This implementation is not perfect, but it is a heck of a lot better than what it was. I included some simple test code that shows it is correct to within rounding error.
Note that writing a dtoa function is deceptively difficult. The original author of this code does not seem to have done much testing of his overly simplistic implementation (if any). If absolute correctness to CLR specs is desired, it may be a good idea to just accept the GC cost of an intermediate string. Otherwise, this new code should be "good enough".
…floating point inaccuracy). The old one had numerous issues, see https://github.com/ferram4/Ferram-Aerospace-Research/issues/183.
Fixes https://github.com/ferram4/Ferram-Aerospace-Research/issues/183
This implementation is not perfect, but it is a heck of a lot better than what it was. I included some simple test code that shows it is correct to within rounding error.
Note that writing a dtoa function is deceptively difficult. The original author of this code does not seem to have done much testing of his overly simplistic implementation (if any). If absolute correctness to CLR specs is desired, it may be a good idea to just accept the GC cost of an intermediate string. Otherwise, this new code should be "good enough".