Skip to content

test: migrate stats/base/dists/normal/quantile to ULP-based assertions - #15102

Draft
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-normal-quantile
Draft

test: migrate stats/base/dists/normal/quantile to ULP-based assertions#15102
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-normal-quantile

Conversation

@kgryte

@kgryte kgryte commented Sep 8, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

ULP bound

All three files use a bound of 1024 ULP, which is the measured minimum.

The package has a single fixture (test/fixtures/r/data.json, 1000 points). The maximum observed ULP difference over the full fixture set is 1024 for the main, factory, and native implementations alike (the worst case being x = 0.5935935935935935, mu = -7, sigma = 29.6). The bound was tightened empirically: at 1023 each of the three files reports exactly one failing assertion, and at 1024 all pass. The native add-on was built locally so that test/test.native.js was actually exercised rather than skipped; the C implementation agrees with the JS implementation on every fixture value, so no separate bound is required.

The previous tolerance was 2100.0 * EPS * abs( expected[ i ] ), so the new bound is a tightening.

The suite was run twice at the final bound with identical results (4057 assertions, all passing), confirming determinism.

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.

Only the three test files are modified; no source, documentation, or fixture changes.

The pre-commit editorconfig-checker hook could not run in this environment because the checker binary is downloaded from a GitHub release that this sandbox cannot reach. The relevant rules (LF line endings, UTF-8, tab indentation, no trailing whitespace, final newline) were verified manually against .editorconfig instead. make lint-javascript-tests passes cleanly for the package.

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

This PR was written primarily by Claude Code, running as an unattended scheduled task. The ULP bound was determined empirically by measuring the maximum ULP difference across the full fixture set and then bisecting to confirm the minimum passing value.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01D1uMqViBMp6d36XsPu1bQR


Generated by Claude Code

Replace computed relative tolerance assertions with `isAlmostSameValue`
ULP comparisons in the fixture loops of `test.quantile.js`,
`test.factory.js`, and `test.native.js`.

The maximum observed ULP difference over the full 1000-point R fixture
is 1024 for the main, factory, and native implementations alike, so all
three files use a bound of 1024 ULP, which is the minimum bound which
passes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D1uMqViBMp6d36XsPu1bQR
@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 Sep 8, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/normal/quantile $\\color{green}306/306$
$\\color{green}+100.00\\%$
$\\color{green}27/27$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}306/306$
$\\color{green}+100.00\\%$

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

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. Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants