Skip to content

feat: support comma thousand separators in calculator expressions#1052

Merged
medcl merged 3 commits intomainfrom
copilot/support-5-032-104-171
Mar 23, 2026
Merged

feat: support comma thousand separators in calculator expressions#1052
medcl merged 3 commits intomainfrom
copilot/support-5-032-104-171

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 23, 2026

The calculator extension fails to evaluate expressions containing comma-formatted numbers like 5,032,104/171 because meval doesn't recognize thousand separators.

  • Strip thousand separators before evaluation: Added strip_thousand_separators() that removes commas appearing between digits before passing to meval for tokenization and evaluation
  • Preserve original input for display: The comma-formatted string is kept in the query payload so the UI shows the user's original input
  • Formatting fix: Collapsed multi-line assert_eq! calls to pass rustfmt CI check
"5,032,104/171"  →  strip_thousand_separators  →  "5032104/171"  →  meval  →  29427.5...

Unit tests cover: basic stripping, multiple commas, both operands, edge cases (empty, leading/trailing comma), and end-to-end evaluation through meval.


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Add strip_thousand_separators() function to remove commas between digits
so that expressions like '5,032,104/171' are properly evaluated.
The original query string with commas is preserved for display.

Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
Agent-Logs-Url: https://github.com/infinilabs/coco-app/sessions/929459f7-054d-4855-bcf5-b1fd68ce0cd3
Copilot AI changed the title [WIP] Support 5,032,104/171 for calculator app feat(calculator): support comma thousand separators in number input Mar 23, 2026
Copilot AI requested a review from medcl March 23, 2026 04:00
@medcl medcl marked this pull request as ready for review March 23, 2026 04:02
Copilot AI changed the title feat(calculator): support comma thousand separators in number input Support comma thousand separators in calculator expressions Mar 23, 2026
@medcl medcl changed the title Support comma thousand separators in calculator expressions feat: support comma thousand separators in calculator expressions Mar 23, 2026
@medcl medcl merged commit 9635675 into main Mar 23, 2026
4 checks passed
@medcl medcl deleted the copilot/support-5-032-104-171 branch March 23, 2026 08:19
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.

3 participants