From cd05f5de1d8770b8acbdcca6adcecd7ed8fe3d52 Mon Sep 17 00:00:00 2001 From: Bipul Lamsal Date: Mon, 6 Apr 2026 23:35:20 +0545 Subject: [PATCH 1/2] numfmt: apply suffix after scaling --- src/uu/numfmt/src/format.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/numfmt/src/format.rs b/src/uu/numfmt/src/format.rs index e1b5101f235..812fe90e0e2 100644 --- a/src/uu/numfmt/src/format.rs +++ b/src/uu/numfmt/src/format.rs @@ -487,8 +487,8 @@ fn transform_to( precision: usize, unit_separator: &str, ) -> Result { - let (i2, s) = consider_suffix(s, opts.to, round_method, precision)?; - let i2 = i2 / (opts.to_unit as f64); + let i2 = s / (opts.to_unit as f64); + let (i2, s) = consider_suffix(i2, opts.to, round_method, precision)?; Ok(match s { None => { format!( From 4c29e0d3f25102b4e720fbd89a2cfe63407cacec Mon Sep 17 00:00:00 2001 From: Bipul Lamsal Date: Tue, 7 Apr 2026 08:30:34 +0545 Subject: [PATCH 2/2] test_numfmt: remove ignore from prefix selection test --- tests/by-util/test_numfmt.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/by-util/test_numfmt.rs b/tests/by-util/test_numfmt.rs index ae03c9ffd5e..116f3ec26d2 100644 --- a/tests/by-util/test_numfmt.rs +++ b/tests/by-util/test_numfmt.rs @@ -1436,12 +1436,8 @@ fn test_zero_pad_sign_order_issue_11664() { .stdout_is("-00000009869647.00\n"); } -// https://github.com/uutils/coreutils/issues/11666 -// `--to-unit=N` selects the output prefix based on the unscaled value -// instead of `value / N`. #[test] -#[ignore = "GNU compat: see uutils/coreutils#11666"] -fn test_to_unit_prefix_selection_issue_11666() { +fn test_to_unit_prefix_selection() { new_ucmd!() .args(&["--to=iec-i", "--to-unit=885", "100000"]) .succeeds()