Skip to content

✨ feat(mq-lang): add percentile builtin function#1453

Merged
harehare merged 1 commit intomainfrom
feat/add-percentile-builtin
Mar 15, 2026
Merged

✨ feat(mq-lang): add percentile builtin function#1453
harehare merged 1 commit intomainfrom
feat/add-percentile-builtin

Conversation

@harehare
Copy link
Copy Markdown
Owner

Add percentile(arr, p) that calculates the p-th percentile of a numeric array using linear interpolation between closest ranks. Returns None for empty arrays and errors on invalid input.

Add `percentile(arr, p)` that calculates the p-th percentile of a
numeric array using linear interpolation between closest ranks.
Returns None for empty arrays and errors on invalid input.
Copilot AI review requested due to automatic review settings March 15, 2026 13:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new percentile(arr, p) helper to the mq-lang standard library (builtin.mq) and corresponding runtime tests (builtin_tests.mq) to support percentile calculations over arrays.

Changes:

  • Introduces percentile(arr, p) implemented in crates/mq-lang/builtin.mq (sorting + linear interpolation).
  • Adds a new test_percentile test suite and registers it in the test runner list.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
crates/mq-lang/builtin.mq Adds the percentile(arr, p) builtin implemented in mq.
crates/mq-lang/builtin_tests.mq Adds percentile test cases and registers them in the test list.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 15, 2026

Merging this PR will not alter performance

✅ 29 untouched benchmarks


Comparing feat/add-percentile-builtin (80ec4e0) with main (379eea6)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (5bb4b48) during the generation of this report, so 379eea6 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@harehare harehare merged commit b8d308d into main Mar 15, 2026
10 checks passed
@harehare harehare deleted the feat/add-percentile-builtin branch March 15, 2026 13:57
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.

2 participants