1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

uucore/num_format: the default precision for %g is 6

This commit is contained in:
Samuel Tardieu 2024-01-05 14:40:45 +01:00
parent e341759dfe
commit 4c5326ffa3

View file

@ -286,7 +286,13 @@ impl Formatter for Float {
let precision = match precision {
Some(CanAsterisk::Fixed(x)) => x,
None => 0,
None => {
if matches!(variant, FloatVariant::Shortest) {
6
} else {
0
}
}
Some(CanAsterisk::Asterisk) => return Err(FormatError::WrongSpecType),
};