floff icon indicating copy to clipboard operation
floff copied to clipboard

%f style formatting

Open legendre6891 opened this issue 1 year ago • 1 comments

Hi -- this is a very interesting technical project!

I wonder if %.[prec]f-style formatting is considered in scope? It seeme the current implementation only covers %.[prec]e. Thanks!

legendre6891 avatar Oct 20 '24 01:10 legendre6891

First of all, thanks a lot!

Actually, I do not plan to polish this project into something really usable by other people. It's more of a "playground" thing. (Rather, I plan to insert at some point in the future such a polished version into my long-abandoned project fp when I finally work on reincarnating it) The primary goal of this repo is to experiment things and do benchmarks. I chose the e-format because that's what Ryu-printf (the main target of comparison) did, and Ryu-printf did so probably because its main focus is on generating large number of digits of general floating-point numbers, where the e-format is much more natural than the f-format.

So, no, I do not consider it "necessarily in-scope" for this project alone. But in a broader context, of course I do consider it, and obviously it's needed for any practical applications. As I said, I will (hopefully) at some point write an implementation and merge it into fp. In fact, I already have written one when I contributed into Boost.CharConv, based on its original author's work: https://github.com/boostorg/charconv/pull/169. But generally I'm not very happy with std::to_chars interface spec, so I'll probably write a different one later.

In any case, if you're considering writing one by yourself, I cannot encourage you more. If you're planning to make a PR with that, that would be even greater.

Or, if you're just looking for a usable implementation, I recommend you to go with Boost.CharConv or {fmt}. Boost.CharConv's implementation is based on this project, and {fmt}'s implementation essentially contains some portion of this project.

jk-jeon avatar Oct 20 '24 06:10 jk-jeon