mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07: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:
committed by
Dorian Péron
parent
0a8155b5c2
commit
bfa8bf72c7
@@ -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),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user