mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
uucore: format: Fix default Float precision in try_from_spec
The default precision is 6, no matter the format. This applies to all float formats, not just "%g" (aka FloatVariant::Shortest). Fixes #7361.
This commit is contained in:
parent
0a8155b5c2
commit
bfa8bf72c7
1 changed files with 1 additions and 7 deletions
|
@ -293,13 +293,7 @@ impl Formatter for Float {
|
|||
|
||||
let precision = match precision {
|
||||
Some(CanAsterisk::Fixed(x)) => x,
|
||||
None => {
|
||||
if matches!(variant, FloatVariant::Shortest) {
|
||||
6
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
None => 6, // Default float precision (C standard)
|
||||
Some(CanAsterisk::Asterisk) => return Err(FormatError::WrongSpecType),
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue