Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

%f style formatting #2

Open
legendre6891 opened this issue Oct 20, 2024 · 1 comment
Open

%f style formatting #2

legendre6891 opened this issue Oct 20, 2024 · 1 comment

Comments

@legendre6891
Copy link

legendre6891 commented Oct 20, 2024

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!

@jk-jeon
Copy link
Owner

jk-jeon commented Oct 20, 2024

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: boostorg/charconv#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants