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

absent precision parameter for floating point format string is undocumented #131159

Open
e00E opened this issue Oct 2, 2024 · 1 comment · May be fixed by #136638
Open

absent precision parameter for floating point format string is undocumented #131159

e00E opened this issue Oct 2, 2024 · 1 comment · May be fixed by #136638
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools A-floating-point Area: Floating point numbers and arithmetic A-fmt Area: `core::fmt` C-bug Category: This is a bug. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@e00E
Copy link
Contributor

e00E commented Oct 2, 2024

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".

@e00E e00E added the C-bug Category: This is a bug. label Oct 2, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 2, 2024
@fmease fmease added A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools T-libs Relevant to the library team, which will review and decide on the PR/issue. A-floating-point Area: Floating point numbers and arithmetic A-fmt Area: `core::fmt` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Oct 2, 2024
@hkBst
Copy link
Member

hkBst commented Jan 23, 2025

@hkBst hkBst linked a pull request Feb 6, 2025 that will close this issue
bors added a commit to rust-lang-ci/rust that referenced this issue Feb 6, 2025
error on empty precision

Fixes rust-lang#131159 by erroring on missing precision. Alternatively we could document current behavior.
hkBst added a commit to hkBst/polyfit-residuals that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/rano that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/simple_optimization that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/xxd-rs that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/yaxpeax-arm that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/tusk that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/wordle-dee that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/octree-art that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/Estatisticas_Descritivas that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/mmo that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/astrors that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/SpriteWriter-ForNES that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/aoc2020 that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/Genetic-Algorithm-SalaryMan that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/aoc2023-rust that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/sudoku_solver that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/splitter that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/Alt-project-rust that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/nuklear that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/jaylox that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/kryl_04 that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/math-algorithm-book that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/polars that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
hkBst added a commit to hkBst/srgb.rs that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
mina86 pushed a commit to mina86/srgb.rs that referenced this issue Feb 8, 2025
A format precision specifier consisting of a dot and no number actually does nothing and has no specified meaning. Currently this is silently ignored, but it may turn into a warning or error.

See rust-lang/rust#131159 and rust-lang/rust#136638
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools A-floating-point Area: Floating point numbers and arithmetic A-fmt Area: `core::fmt` C-bug Category: This is a bug. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants