Skip to content

test: migrate stats/base/dists/pareto-type1/median to ULP-based assertions - #14155

Draft
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-pareto-type1-median
Draft

test: migrate stats/base/dists/pareto-type1/median to ULP-based assertions#14155
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-pareto-type1-median

Conversation

@kgryte

@kgryte kgryte commented Aug 11, 2026

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

Converted files:

  • test/test.js

The package has no test/test.native.js (no C implementation is currently present in develop), so test/test.js is the only test file in the package.

ULP bounds

The single fixture loop (fixtures/julia/data.json, 1000 cases) uses:

t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' );
File Previous tolerance ULP constant Measured minimum
test.js 1.0 * EPS * abs( expected[i] ) 0 0

The bound was determined empirically. Starting from 64, the constant was lowered until the suite no longer passed; it passed at every step down to and including 0. Independently, the ULP distance was computed via @stdlib/number/float64/base/ulp-difference for all 1000 fixture cases, and the maximum observed distance was 0 — i.e., every returned value is bit-identical to the Julia reference value, so 0 is the tightest possible bound. The suite was run twice at the final value to confirm determinism (1014/1014 assertions passing on both runs).

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Resolves a part of #11352.

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 test files are modified; no source, docs, or benchmark changes.
  • Linting was verified with make lint-javascript-tests TESTS_FILTER=".*/stats/base/dists/pareto-type1/median/.*" (clean).
  • The editorconfig-checker pre-commit step could not download its binary in this environment; EditorConfig compliance (LF line endings, tab indentation, no trailing whitespace, final newline) was verified manually instead.

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.

This PR was written primarily by Claude Code, which studied the prior ULP migrations in this family (e.g. stats/base/dists/pareto-type1/quantile, stats/base/dists/pareto-type1/kurtosis, stats/base/dists/signrank/quantile), applied the same idiom, and measured the minimum ULP bound over the full fixture set.


@stdlib-js/reviewers


Generated by Claude Code

…ertions

Replaces the relative tolerance (`EPS`/`delta`/`tol`) comparison in the
fixture loop with an ULP-based assertion using
`@stdlib/assert/is-almost-same-value`. The ULP bound was tightened to the
measured minimum (0), as every returned value is bit-identical to the
Julia reference value.

Ref: #11352

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/pareto-type1/median $\\color{green}125/125$
$\\color{green}+100.00\\%$
$\\color{green}8/8$
$\\color{green}+100.00\\%$
$\\color{green}1/1$
$\\color{green}+100.00\\%$
$\\color{green}125/125$
$\\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.

2 participants