Skip to content

test: migrate stats/base/dists/chi/stdev to ULP-based assertions - #14447

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-stats-base-dists-chi-stdev
Aug 21, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-stats-base-dists-chi-stdev

Conversation

@kgryte

@kgryte kgryte commented Aug 20, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

This pull request:

  • migrates the tests for @stdlib/stats/base/dists/chi/stdev from relative-tolerance assertions to ULP-based assertions using @stdlib/assert/is-almost-same-value, per the guidance in [RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue) #11352.
  • updates both test/test.js and test/test.native.js to mirror the idiom used in previously converted packages (e.g. stats/base/dists/erlang/stdev, stats/base/dists/frechet/variance).
  • replaces the previous 50.0 * EPS * abs( expected[ i ] ) tolerance loop with t.strictEqual( isAlmostSameValue( y, expected[ i ], 64 ), true, 'returns expected value' ).
  • drops the now-unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires.

The tightest ULP bound was determined empirically by measuring the maximum ULP difference over the full 1000-value Python fixture set:

  • test/test.js: N = 64 ULP (max observed ULP difference over the fixtures is exactly 64; the worst case is k = 7.448033732206665, where stdev(k) differs from the expected value by 64 ULP).
  • test/test.native.js: N = 64 ULP (same fixtures; native tests are skipped in this environment because the native add-on is not built, so the same bound is used for consistency with the JavaScript implementation).

The tests were run twice at the final N = 64 (1005 assertions, all passing) to confirm the bound is deterministic.

Related Issues

This pull request has the following related issues:

Questions

No.

Other

No.

Checklist

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 authored by Claude Code (Anthropic) running as an unattended scheduled task. The conversion mirrors the exact idiom used in previously merged ULP migrations authored by the PR author (e.g. #14439, #14434), and the ULP bound was measured empirically against the existing Python fixtures.


@stdlib-js/reviewers


Generated by Claude Code

Ref: #11352

---
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: passed
  - 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 Aug 20, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/chi/stdev $\\color{green}159/159$
$\\color{green}+100.00\\%$
$\\color{green}5/5$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}159/159$
$\\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 Aug 21, 2026
@kgryte
kgryte marked this pull request as ready for review August 21, 2026 00:02
@kgryte
kgryte requested a review from a team August 21, 2026 00:02
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 21, 2026
@kgryte
kgryte merged commit 87e6008 into develop Aug 21, 2026
82 checks passed
@kgryte
kgryte deleted the kgryte/ulp-stats-base-dists-chi-stdev branch August 21, 2026 00:03
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 21, 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. 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