Commit Graph
78 Commits
Author SHA1 Message Date
pocopepeandDaniel Hofstetter 375fc3cd48 numfmt: reject %f values too large to format exactly 2026-05-01 09:40:58 +02:00
hayato0909andDaniel Hofstetter 7d3a3475b2 numfmt: fix rounding for small scaled values 2026-04-27 17:29:29 +02:00
Devel08andGitHub c5bdff1816 numfmt: treat multibyte chars as a single character (#11992)
* treat multibyte chars as a single character

* add test for issue 11937
2026-04-25 18:51:57 +02:00
pocopepeandDaniel Hofstetter e348e13e77 numfmt: cap IEC precision at 3 decimals 2026-04-25 16:41:30 +02:00
Devel08andGitHub d836730024 numfmt: respect --invalid mode when rejecting scientific notation (#11945)
* fix #11935

* code style and error message

* cargo fmt

* add test for issue 11935

* Update test_numfmt.rs

* check for the expected output in test
2026-04-23 17:29:40 +02:00
vijuandGitHub b3469aeef6 numfmt: honor LC_NUMERIC for decimal separator (#11941)
* numfmt: honor LC_NUMERIC for decimal separator

* fixing clippy warning

* fix spell-checker and skip locale tests on WASI
2026-04-22 15:53:07 +02:00
AnthonyandGitHub 36ac85b1f3 tests: add WASI integration test support via wasmtime 2026-04-12 15:19:04 +02:00
Bipul LamsalandGitHub 2ca1a10e4d numfmt: fix --to=auto to return with exitcode=1 (#11701)
* numfmt: fix --to=auto to return with exitcode=1

* numfmt: update direct variable use in format macro

* numfmt_test: remove extra test

* numfmt: replacing format in translate directly
2026-04-10 17:59:18 +02:00
f9efb9e459 numfmt: don't ignore precision "0" in --format when combined with --to (#11683)
* Update format.rs

* numfmt fix #11667

* numfmt --format fix

* remove ignore of test for #11667 in test_numfmt.rs

* Add space after slashes in a comment

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>

* change is_precision with a more understandable name

* Leave an empty line between functions

---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2026-04-10 15:04:44 +02:00
Devel08GitHubDaniel Hofstetterpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
b352f83edd forbid scientific notation in numfmt #11655 (#11721)
* forbid scientific notation arguments in numfmt

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Edit solution of #116555

* add scientific notation test

* change variable name

* use is_ascii_digit() instead of checking manually

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* Apply suggestion from @cakebaker

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2026-04-10 11:47:31 +02:00
THEMIScaleandGitHub ceacc677a4 fix(numfmt):fix precision loss for large numbers in #11654 (#11716)
* fix(numfmt):fix recision loss for large numbers in #11654

* numfmt: fix some tests in format.rs caused by importing numeric.rs

* add a file header and remove a redundant comment

* remove a redundant comment

* add a empty line between two functions

* refactor(numfmt): rename helper functions for accuracy; fix double negation logic
2026-04-10 10:15:06 +02:00
THEMIScaleandGitHub 66d4fae8b3 numfmt: fix GNU compat issue #11653 & correct test cases (#11695) 2026-04-07 15:21:34 +02:00
Sim-huandGitHub dba549141c 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
2026-04-07 13:26:40 +02:00
Bipul LamsalandGitHub d2726f254a numfmt: apply prefix after scaling for --to-unit (#11684)
* numfmt: apply suffix after scaling

* test_numfmt: remove ignore from prefix selection test
2026-04-07 10:24:32 +02:00
Eshwar Singh RajaputanaandGitHub 79c90ff704 numfmt: preserve fractional digits when --from-unit is used without suffix and fixed String format (#11674)
* numfmt: preserve fractional digits when --from-unit is used without suffix and fixed String format

* numfmt: simplify redundant if branches caught by clippy

* numfmt: fix precision condition to only preserve decimals when input has no unit suffix
2026-04-06 10:58:18 +02:00
Sylvestre Ledru 53c7d6fb9d numfmt: add failing test cases 2026-04-05 23:49:19 +02:00
Sylvestre Ledru 864e95a253 numfmt: buffer output in non-abort invalid modes and re-enable GNU tests
Buffer formatted output so that --invalid=fail does not duplicate lines
on error, and --invalid=abort streams directly for partial output.

Fixes GNU numfmt.pl test: field-3. Re-enables the full numfmt.pl test
suite by removing the skip list added earlier in the stack.
2026-04-04 23:24:46 +02:00
Sylvestre Ledru d68ff519b5 numfmt: add --grouping flag, debug diagnostics, and stricter number validation
Fixes GNU numfmt.pl tests: grp-1, grp-2, debug-2, fmt-err-9,
fmt-err-11.
2026-04-04 23:24:46 +02:00
Sylvestre Ledru 64a003040a numfmt: support explicit --unit-separator for suffix parsing 2026-04-04 23:24:46 +02:00
FidelSchandDaniel Hofstetter dd6b88b264 fix(numfmt): format output on error messages 2026-03-04 09:28:11 +01:00
FidelSchandDaniel Hofstetter 995c6dcdcd fix(numfmt): update line termination handling for consistency with GNU behavior 2026-03-02 10:34:17 +01:00
FidelSchandDaniel Hofstetter 8a7a7788e7 format test_numfmt 2026-03-02 10:34:17 +01:00
FidelSchandDaniel Hofstetter f197618f7d fix(numfmt): Read lines only up to null byte (as GNU does) 2026-03-02 10:34:17 +01:00
Christopher DrydenandSylvestre Ledru 1e5eb7c942 numfmt: fix empty delimiter and whitespace handling 2026-02-15 22:05:40 +01:00
Chris DrydenandGitHub fb6a2bb147 numfmt: add --debug flag to print warnings about invalid input (#10110) 2026-02-02 15:13:22 +01:00