numfmt: fix zero-padding placement for negative numbers (#11694)

* numfmt: fix zero-padding placement before sign for negative numbers

When using zero-padded format (e.g. %018.2f), the sign character is now
placed before the padding zeros, matching C printf behavior.

Fixes #11664

* numfmt: simplify sign handling with combined strip_prefix
This commit is contained in:
Sim-hu
2026-04-07 13:26:40 +02:00
committed by GitHub
parent 32cf4cdf0c
commit dba549141c
2 changed files with 6 additions and 2 deletions
-1
View File
@@ -1428,7 +1428,6 @@ fn test_from_unit_fractional_precision_issue_11663() {
// Zero-padded `--format` places padding zeros before the sign for negative
// numbers; GNU (and C printf) puts the sign first.
#[test]
#[ignore = "GNU compat: see uutils/coreutils#11664"]
fn test_zero_pad_sign_order_issue_11664() {
new_ucmd!()
.args(&["--from=none", "--format=%018.2f", "--", "-9869647"])