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

Any plan for libc++ to support std::from_chars for floating points? #92711

Closed
Extra-Creativity opened this issue May 20, 2024 · 9 comments
Closed
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

Comments

@Extra-Creativity
Copy link

It may be frustrating to know c++17 feature isn't supported in the latest libc++ yet.

GCC 12 has partially adopted https://github.com/fastfloat/fast_float as its library implementation, is it possibly proper to adopt it in libc++?

@github-actions github-actions bot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label May 20, 2024
@mordante mordante added the question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead! label May 20, 2024
@mordante
Copy link
Member

I understand it's frustrating. However this feature is a lot of work even adapting an existing algorithm requires quite a bit of effort. Thusfar nobody has volunteered to do the work.

There is this WIP PR #91651 to use LLVM's libc implementation. I don't know which algorithm they use. IIRC it's one Lemire worked on so it might be fast float.

Since we don't use bugs to track missing parts of our implementation I'm closing the issue.

@Extra-Creativity
Copy link
Author

I really appreciate volunteers' efforts. The mentioned PR seems not complete yet (not having error handling), but I believe this will be solved in the near future. Great thanks to you all.

@mordante
Copy link
Member

I really appreciate volunteers' efforts.

Thanks!

The mentioned PR seems not complete yet (not having error handling), but I believe this will be solved in the near future. Great thanks to you all.

That PR indeed not complete and it may take some time. It is the first time libc++ and libc are sharing code. So we're also looking how to do that.

@michaelrj-google
Copy link
Contributor

Hi! I'm still working on the proof of concept PR (I want to make sure all the tests pass) but I am hopeful that it's going to lead to a finished implementation before the end of the year. As for the algorithm it uses, it is primarily the one that Lemire worked on, I gave a talk on exactly how it works at the 2022 dev conference: https://www.youtube.com/watch?v=s-UjbTV8p6g

@lemire
Copy link

lemire commented Sep 11, 2024

@michaelrj-google @ldionne

GCC (since GCC12) uses https://github.com/fastfloat/fast_float for from_chars. It is fully spec compliant and can just be dropped in with maybe a thin wrapper. It is an open community project. To my knowledge, it is effectively bug free at this point.

@philnik777
Copy link
Contributor

@lemire Thanks for the suggestion, but we've decided to share the code with the LLVM libc. See #91651 for the status.

@lemire
Copy link

lemire commented Sep 11, 2024

@philnik777 Looking forward to the implementation. We'll be able to benchmark!!! :-)

@ldionne
Copy link
Member

ldionne commented Sep 19, 2024

@michaelrj-google @ldionne

GCC (since GCC12) uses https://github.com/fastfloat/fast_float for from_chars. It is fully spec compliant and can just be dropped in with maybe a thin wrapper. It is an open community project. To my knowledge, it is effectively bug free at this point.

Thanks for the ping. I actually wanted to reach out to you for your implementation, and then @michaelrj-google suggested using the LLVM libc implementation so we went for that. I'll be eager to see how the implementations compare performance-wise.

@lemire
Copy link

lemire commented Sep 20, 2024

then @michaelrj-google suggested using the LLVM libc implementation so we went for that

I think that's 100% a good recommendation as far as I can tell. I'll be happier if we end up with competing implementations. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Projects
None yet
Development

No branches or pull requests

6 participants