Skip to content

Commit 6ecb4a5

Browse files
committed
numfmt: fix precision condition to only preserve decimals when input has no unit suffix
1 parent f8e4494 commit 6ecb4a5

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/uu/numfmt/src/format.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,12 @@ fn format_string(
542542

543543
let precision = if let Some(p) = options.format.precision {
544544
p
545-
} else if options.transform.to == Unit::None {
545+
} else if options.transform.to == Unit::None
546+
&& !source_without_suffix
547+
.chars()
548+
.last()
549+
.is_some_and(char::is_alphabetic)
550+
{
546551
parse_implicit_precision(source_without_suffix)
547552
} else {
548553
0

0 commit comments

Comments
 (0)