Skip to content

test: migrate stats/base/dists/erlang/quantile to ULP-based assertions - #15753

Merged
kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-rk9opn
Oct 2, 2026
Merged

kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-rk9opn

Conversation

@kgryte

@kgryte kgryte commented Oct 1, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

The computed delta/tol comparisons in the fixture loops of test/test.quantile.js and test/test.factory.js are replaced with isAlmostSameValue( y, expected[ i ], 7 ) assertions, and the now-unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires are dropped in favor of @stdlib/assert/is-almost-same-value. No other test cases were touched; the exact comparisons elsewhere in these files are unchanged. test/test.js contains no tolerance-based assertions and is therefore unmodified. This package has no test/test.native.js.

The ULP bound is the measured minimum over each full fixture set, confirmed by observing failures at N-1:

Fixture Measured max ULP diff ULP bound
fixtures/julia/both_large.json 7 7
fixtures/julia/large_shape.json 7 7
fixtures/julia/large_rate.json 7 7

Each fixture set contains 1000 cases. The same minimum of 7 holds for both implementations under test (lib/main.js and lib/factory.js), so test.factory.js uses the same bound as test.quantile.js. At N = 6 the suite reports 4 failing assertions, so 7 is the tightest integer bound. The suite was run twice at the final bound, with identical results both times (3022 + 3021 + 3 assertions passing).

Note that the previous bounds were expressed as 20.0 * EPS for both_large.json and 10.0 * EPS for the other two fixtures; the uniform 7 ULP bound is tighter than all three.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

  • make lint-javascript-tests TESTS_FILTER=".*/stats/base/dists/erlang/quantile/.*" is clean.
  • The idiom mirrors the already-converted sibling packages stats/base/dists/betaprime/logpdf and stats/base/dists/beta/logpdf.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was written by Claude Code, which also measured the minimum ULP bound empirically and ran the tests and linter.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_012bYe5QJPN9wJxUADzW1a6S


Generated by Claude Code

Replace the computed `delta`/`tol` comparisons in the fixture loops
of `test/test.quantile.js` and `test/test.factory.js` with
`isAlmostSameValue` assertions using the measured minimum ULP bound
of 7.

Ref: #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012bYe5QJPN9wJxUADzW1a6S

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: skipped
  - task: lint_markdown_pkg_readmes
    status: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Good First PR A pull request resolving a Good First Issue. labels Oct 1, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Hello! 👋

We've noticed that you've been opening a number of PRs addressing good first issues. Thank you for your interest and enthusiasm!

Now that you've made a few contributions, we suggest no longer working on good first issues. Instead, we encourage you to prioritize cleaning up any PRs which have yet to be merged and then proceed to work on more involved tasks.

Not only does this ensure that other new contributors can work on things and get ramped up on all things stdlib, it also ensures that you can spend your time on more challenging problems. 🚀

For ideas for future PRs, feel free to search the codebase for TODOs and FIXMEs and be sure to check out other open issues on the issue tracker. Cheers!

@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/erlang/quantile $\\color{green}196/196$
$\\color{green}+100.00\\%$
$\\color{green}9/9$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}196/196$
$\\color{green}+100.00\\%$

The above coverage report was generated for the changes in this PR.

@kgryte kgryte added the Tests Pull requests specifically adding tests. label Oct 2, 2026
@kgryte
kgryte marked this pull request as ready for review October 2, 2026 02:13
@kgryte
kgryte requested a review from a team October 2, 2026 02:13
@kgryte
kgryte merged commit 272680c into develop Oct 2, 2026
66 checks passed
@kgryte
kgryte deleted the claude/great-brahmagupta-rk9opn branch October 2, 2026 02:14
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Good First PR A pull request resolving a Good First Issue. Needs Review A pull request which needs code review. Statistics Issue or pull request related to statistical functionality. Tests Pull requests specifically adding tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants