Skip to content

fix: scientific notation is incorrectly parsed in general numeric sort#10437

Merged
ChrisDryden merged 3 commits intouutils:mainfrom
Kaua-Klassmann:fix_scientific_notation_is_incorrectly_parsed_in_general_sort
Feb 12, 2026
Merged

fix: scientific notation is incorrectly parsed in general numeric sort#10437
ChrisDryden merged 3 commits intouutils:mainfrom
Kaua-Klassmann:fix_scientific_notation_is_incorrectly_parsed_in_general_sort

Conversation

@Kaua-Klassmann
Copy link
Contributor

Description

This PR fixes the general numeric sort to parse correctly scientific notations with sign

Changes

  • Change "peek_nth(2)" to "peek_nth(1)" on get_leading_gen
  • Add "exponents-positive-general" test to validate general numeric sort

Fixes #10317

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 22, 2026

Merging this PR will degrade performance by 7.32%

❌ 1 regressed benchmark
✅ 283 untouched benchmarks
⏩ 38 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation sort_general_numeric[200000] 660.8 ms 712.9 ms -7.32%

Comparing Kaua-Klassmann:fix_scientific_notation_is_incorrectly_parsed_in_general_sort (33f9585) with main (ec7e81e)

Open in CodSpeed

Footnotes

  1. 38 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)

Comment on lines 465 to 469
#[test]
fn test_exponents_positive_general() {
test_helper("exponents-positive-general", &["-g"]);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am not a fan of this test (and the fixtures/sort files)
please test this way:
printf '1\n1e-5' | sort -g

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tty/tty-eof (fails in this run but passes in the 'main' branch)

@ChrisDryden
Copy link
Collaborator

I don't think I would be too worried about the performance regression here since the benchmark was only 1 digit scientific notation numbers anyways so the entire benchmark wasn't even going in this code path before

Copy link
Collaborator

@ChrisDryden ChrisDryden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just waiting on the CI

@ChrisDryden ChrisDryden merged commit 808865e into uutils:main Feb 12, 2026
153 of 155 checks passed
@Kaua-Klassmann Kaua-Klassmann deleted the fix_scientific_notation_is_incorrectly_parsed_in_general_sort branch February 12, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sort: scientific notation with sign is incorrectly parsed in general numeric sort

3 participants