rust-lang / rust-lang/rust

absent precision parameter for floating point format string is undocumented

Open
#131,159 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-docs A-floating-point A-fmt C-bug T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I am talking about format strings of the form format!"{:.}", 1.234). The corresponding documentation for the precision argument is here. The documentation writes that the format is .N where N is an integer specifying the precision.

The bug is that it is not documented that N can also be absent. Either this should not be accepted by the compiler or it should be documented.

I believe the intention is that an absent N means the same thing as if there was no precision specified at all (no :.). Note that this is not the same as "as much precision as needed".

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the precision argument documentation at the linked std::fmt page and compare its stated .N syntax with the accepted :. form. Document what an absent precision value means and distinguish it from unspecified precision; the work is done when the syntax and behavior are clear to readers.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.