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!( 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()