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 sprintf "%f" in Crystal using Ryu Printf #14067

Merged
merged 5 commits into from Dec 13, 2023

Conversation

HertzDevil
Copy link
Contributor

@HertzDevil HertzDevil commented Dec 7, 2023

Closes #12473. Resolves part of #8441.

%e, %g, %a, and their uppercase variants will be implemented in subsequent PRs; this PR sets up the general code structure.

Note that it is undefined behavior in C to specify both the 0 flag and a precision for float formats, but Ruby supports it, so Crystal follows suit.

@HertzDevil
Copy link
Contributor Author

HertzDevil commented Dec 7, 2023

It seems the large constant tables are breaking WebAssembly CI in a similar fashion to #13918?

@@ -334,6 +346,75 @@ struct String::Formatter(A)
pad(str_size, flags) if flags.right_padding?
end

{% unless flag?(:wasm32) %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be redundant due to the LLVM optimizations?

spec/std/float_printer/ryu_printf_spec.cr Outdated Show resolved Hide resolved
spec/std/float_printer/ryu_printf_spec.cr Outdated Show resolved Hide resolved
spec/std/float_printer/ryu_printf_spec.cr Outdated Show resolved Hide resolved
spec/std/float_printer/ryu_printf_spec.cr Outdated Show resolved Hide resolved
@straight-shoota straight-shoota added this to the 1.11.0 milestone Dec 12, 2023
@straight-shoota straight-shoota merged commit 93c9df4 into crystal-lang:master Dec 13, 2023
55 checks passed
@HertzDevil HertzDevil deleted the feature/ryu-printf2 branch December 13, 2023 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants