Closed gershnik closed 1 year ago
Unless I am missing something there appears to be no reverse conversion in this library.
There is no such reverse conversion, yes.
I am planning to develop a more fully-featured floating-point conversion library someday, but that will be another library. The reason is because, in order to add the reverse conversion, I have to add a considerable amount of new entries into the already big static data table. (This is why Ryu has a bigger table than Dragonbox.) I am expecting that there may be many people who are happy with just one direction of conversion, so this library will mostly stay as is.
I think probably you do not want full floating-point <-> string conversions, rather just the conversion between binaries and decimals. But if you do want the conversions from/to strings, then you can consider using the Boost.charconv library: https://github.com/cppalliance/charconv
(Or I guess you can make a feature request about binary <-> decimal conversions?)
It seems this library is also still in development at this point, but I guess it is maybe almost done and you can probably use most of its features. It currently internally uses Dragonbox for the shortest-roundtrip conversion from binary to decimal, if I understood correctly.
Would be great if decimal_fp were exposed as a first class thing
It is a first class thing already (i.e., it is supposed to be the user-facing interface), though it lacks things you mentioned.
I am closing this issue because the feature you are requesting will not be implemented. But thanks for your interest anyway!
By the way, for this:
As an aside it also looks like
to_chars
only does exponential notation. Lack of fixed format would be another stumbling block.
please see https://github.com/jk-jeon/dragonbox/issues/35. This is likely to be added in a future.
Fair enough. Thank you!
Unless I am missing something there appears to be no reverse conversion in this library.
I am trying to convert Ryu based code that operates on moral equivalent of decimal_fp (doing more than just printing) to Dragonbox. Lack of reverse conversion is a big stumbling block because I would need to essentially carry around big chunks of Ryu data and code to do it.
As an aside it also looks like
to_chars
only does exponential notation. Lack of fixed format would be another stumbling block.Would be great if decimal_fp were exposed as a first class thing with conversion and formatting functions. 😃