Skip to content

test: migrate stats/base/dists/gumbel/entropy to ULP-based assertions - #15360

Draft
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-stats-base-dists-gumbel-entropy
Draft

kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-stats-base-dists-gumbel-entropy

Conversation

@kgryte

@kgryte kgryte commented Sep 20, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

  • migrates the tests for stats/base/dists/gumbel/entropy from relative tolerance testing to ULP difference testing, per [RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue) #11352.
  • replaces the delta/tol computation and t.ok( delta <= tol, ... ) assertion in the Julia fixture loops of test/test.js and test/test.native.js with t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );.
  • adds the @stdlib/assert/is-almost-same-value require and drops the now unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires.

Final ULP constant: 1 (used in both test/test.js and test/test.native.js).

This is the measured minimum. Over the full 100-element Julia fixture set, the largest observed ULP difference between the returned and expected values is exactly 1; at 0 ULP, 16 of the 110 assertions fail. The suite was run twice at the final value with identical results (110/110 passing, no FMA/arch variation). Consistent with the convention in already-migrated sibling packages (e.g. lognormal/entropy, normal/entropy), the same bound is used in the native test file.

Only the two test files are changed.

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 test TESTS_FILTER=".*/stats/base/dists/gumbel/entropy/.*" could not be used in this environment: make install-node-modules fails because es-object-atoms@^1.1.2 is not published (the registry has at most 1.1.1). This is a pre-existing dependency-resolution failure unrelated to this change. The package's test files were instead executed directly against the repository's lib/node_modules tree, giving 110/110 passing for test/test.js; test/test.native.js skips, as the native add-on is not built.
  • Linting was run with the repository's own configuration (etc/eslint/.eslintrc.tests.js) over both changed files and is clean. The editorconfig-checker step could not execute because its binary is downloaded from GitHub releases, which is unavailable here; both files were verified manually against .editorconfig (LF line endings, UTF-8, tab indentation, no trailing whitespace, final newline).

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 authored by Claude Code, running as an unattended scheduled task. Claude studied #11352 and the already-migrated sibling packages to mirror the established idiom, applied the migration, and determined the ULP bound empirically by measuring the per-fixture ULP difference and confirming the suite fails at 0 and passes deterministically at 1.


@stdlib-js/reviewers


Generated by Claude Code

Replaces the computed relative tolerance assertions in the fixture
loops with `isAlmostSameValue` ULP comparisons. The ULP bound was
tightened to the measured minimum of 1 ULP over the full Julia
fixture set.

Ref: #11352

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

---
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 Sep 20, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/gumbel/entropy $\\color{green}177/177$
$\\color{green}+100.00\\%$
$\\color{green}9/9$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}177/177$
$\\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