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

Implement the Ryu Printf algorithm #12473

Closed
wants to merge 3 commits into from

Conversation

HertzDevil
Copy link
Contributor

This is a direct port of d2fixed.c. See #8441 (comment). Note that Dragonbox does not have an equivalent for arbitrary precision printing.

sprintf does not use this yet, because currently the algorithm can only write to a buffer, never to an IO. On the other hand Number#format can probably switch to this method immediately.

@straight-shoota
Copy link
Member

You named this as an alternative approach to #13143.
What's missing here?

@HertzDevil
Copy link
Contributor Author

String::Formatter#float needs to be patched to use Ryu Printf rather than LibC.snprintf, and then Crystal::System.print_error can use String#% directly.

For LibC.printf: #13161

@HertzDevil HertzDevil closed this Dec 11, 2023
@HertzDevil HertzDevil deleted the feature/ryu-printf branch December 11, 2023 12:26
@HertzDevil HertzDevil restored the feature/ryu-printf branch December 11, 2023 12:26
@HertzDevil HertzDevil reopened this Dec 11, 2023
@HertzDevil HertzDevil deleted the feature/ryu-printf branch December 13, 2023 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Withheld
Development

Successfully merging this pull request may close these issues.

2 participants