* src/numfmt.c (simple_strtod_human): Only look for 'i'
after detecting a suffix.
* tests/misc/numfmt.pl: Add a test case.
* NEWS: Mention the bug fix.
Reported at https://bugs.debian.org/
1091758
Previously it would have ignored the affinity mask on such systems.
[bug introduced with nproc in coreutils-8.1]
+ numfmt --from=iec-i now works with numbers without a suffix.
+ Previously such numbers were rejected with an error.
+ [bug introduced with numfmt in coreutils-8.21]
+
printf now diagnoses attempts to treat empty strings as numbers,
as per POSIX. For example, "printf '%d' ''" now issues a diagnostic
and fails instead of silently succeeding.
devmsg (" Auto-scaling, found 'i', switching to base %d\n",
scale_base);
}
+ else if (allowed_scaling == scale_IEC_I)
+ {
+ if (**endptr == 'i')
+ (*endptr)++;
+ else
+ return SSE_MISSING_I_SUFFIX;
+ }
*precision = 0; /* Reset, to select precision based on scale. */
}
- if (allowed_scaling == scale_IEC_I)
- {
- if (**endptr == 'i')
- (*endptr)++;
- else
- return SSE_MISSING_I_SUFFIX;
- }
-
long double multiplier = powerld (scale_base, power);
devmsg (" suffix power=%d^%d = %Lf\n", scale_base, power, multiplier);
['4', '--from=auto 1K', {OUT => "1000"}],
['5', '--from=auto 1Ki', {OUT => "1024"}],
['5.1', '--from=iec-i 1Ki', {OUT => "1024"}],
+ ['5.2', '--from=iec-i 1', {OUT => "1"}],
['6', {IN_PIPE => "1234\n"}, {OUT => "1234"}],
['7', '--from=si', {IN_PIPE => "2K\n"}, {OUT => "2000"}],