Debian Bug report logs - #1094384
coreutils: numfmt: please document precision determination (or factor in --to-unit)

version graph

Package: coreutils; Maintainer for coreutils is Michael Stone <[email protected]>; Source for coreutils is src:coreutils (PTS, buildd, popcon).

Reported by: наб <[email protected]>

Date: Mon, 27 Jan 2025 17:12:01 UTC

Severity: normal

Found in version coreutils/9.4-3

Reply or subscribe to this bug.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to [email protected], Michael Stone <[email protected]>:
Bug#1094384; Package coreutils. (Mon, 27 Jan 2025 17:12:02 GMT) (full text, mbox, link).


Acknowledgement sent to наб <[email protected]>:
New Bug report received and forwarded. Copy sent to Michael Stone <[email protected]>. (Mon, 27 Jan 2025 17:12:02 GMT) (full text, mbox, link).


Message #5 received at [email protected] (full text, mbox, reply):

From: наб <[email protected]>
To: Debian Bug Tracking System <[email protected]>
Subject: coreutils: numfmt: please document precision determination (or factor in --to-unit)
Date: Mon, 27 Jan 2025 18:09:32 +0100
[Message part 1 (text/plain, inline)]
Package: coreutils
Version: 9.1-1
Version: 9.4-3
Severity: normal

Dear Maintainer,

Please document how numfmt determines the output precision.
I was about to report that
  $ numfmt --to-unit 10 1
  1
  $ numfmt --to-unit 10 3
  1
  $ numfmt --to-unit 3 10
  4
but guessed that maybe
  $ numfmt --to-unit 10 1.0
  0.1
  $ numfmt --to-unit 3 10.0
  3.4
  $ numfmt --to-unit 3 10.000
  3.334
  $ numfmt --to-unit 3 10.000000
  3.333334
which holds.

This is surprising at best, and after a few keywords
I hit on this being mentioned in the manual as
       FORMAT  must  be suitable for printing one floating-point argument '%f'.
       Optional quote (%'f) will enable --grouping (if supported by current lo‐
       cale).   Optional  width  value  (%10f)  will  pad output. Optional zero
       (%010f) width will zero pad the number. Optional negative values (%-10f)
       will  left align.  Optional precision (%.1f) will override the input de‐
       termined precision.
which doesn't actually say how it's determined,
and is tucked into the end of a nauseating paragraph about something unrelated.

Notably, this is not how anything else behaves, either, AFAICT
(per seq precedent you'd expect the full but minimal precision for the output).

Best,

-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: x32 (x86_64)
Foreign Architectures: amd64, i386

Kernel: Linux 6.7.7-amd64 (SMP w/2 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_FORCED_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages coreutils depends on:
ii  libacl1               2.3.2-1
ii  libattr1              1:2.5.2-1
ii  libc6                 2.38-13
ii  libgmp10              2:6.3.0+dfsg-2
ii  libselinux1           3.5-2
ii  libssl3t64 [libssl3]  3.3.2-2

coreutils recommends no packages.

coreutils suggests no packages.

-- no debconf information
[signature.asc (application/pgp-signature, inline)]

Send a report that this bug log contains spam.


Debian bug tracking system administrator <[email protected]>. Last modified: Tue May 13 08:47:16 2025; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU General Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.