We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
float_to_decimal_common in src/libcore/fmt/float.rs does this:
let mut buf = [0; 1024]; let mut parts = [flt2dec::Part::Zero(0); 16];
and then passes buf and parts to flt2dec::to_exact_fixed_str or flt2dec::to_shortest_str
Looking at the docs for those functions at https://ticki.github.io/redocs/std/num/flt2dec/fn.to_exact_fixed_str.html and https://ticki.github.io/redocs/std/num/flt2dec/fn.to_shortest_str.html the "parts" array needs to have length at least 5, right? And the "buf" array needs to be at least 800+ for the to_exact_fixed_str case but only 17 (MAX_SIG_DIGITS) for the to_shortest_str case, afaict. Changing the to_shortest_str case to not use the huge buffer would probably help out https://users.rust-lang.org/t/excessive-stack-usage-for-formatting/8023 too.
Also, it's not clear to me that the "buf" scratch buffer needs to be zero-initialized. Does it?
The text was updated successfully, but these errors were encountered:
Note that I'm poking at this a bit.
Sorry, something went wrong.
I spun off the zeroing thing into #41259 because I have a fix for that... we may still want to make the stackframe here smaller, though.
a21f616
No branches or pull requests
float_to_decimal_common in src/libcore/fmt/float.rs does this:
and then passes buf and parts to flt2dec::to_exact_fixed_str or flt2dec::to_shortest_str
Looking at the docs for those functions at https://ticki.github.io/redocs/std/num/flt2dec/fn.to_exact_fixed_str.html and https://ticki.github.io/redocs/std/num/flt2dec/fn.to_shortest_str.html the "parts" array needs to have length at least 5, right? And the "buf" array needs to be at least 800+ for the to_exact_fixed_str case but only 17 (MAX_SIG_DIGITS) for the to_shortest_str case, afaict. Changing the to_shortest_str case to not use the huge buffer would probably help out https://users.rust-lang.org/t/excessive-stack-usage-for-formatting/8023 too.
Also, it's not clear to me that the "buf" scratch buffer needs to be zero-initialized. Does it?
The text was updated successfully, but these errors were encountered: