Skip to content

test: migrate stats/incr/mprod to ULP-based assertions - #15963

Draft
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-stats-incr-mprod
Draft

kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-stats-incr-mprod

Conversation

@kgryte

@kgryte kgryte commented Oct 7, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

Specifically, this pull request:

  • adds the @stdlib/assert/is-almost-same-value import and removes the now-unused @stdlib/constants/float64/eps and @stdlib/math/base/special/abs imports.
  • removes the delta/tol computations in the overflow may be transient and underflow may be transient test cases, replacing them with an actual variable.
  • replaces the corresponding t.strictEqual( delta <= tol, ... ) assertions with t.strictEqual( isAlmostSameValue( actual, expected, 1 ), true, 'returns expected value' );.

Only test/test.js is modified; the package has no test/test.native.js. No other test cases were touched, and existing exact comparisons (t.strictEqual/t.deepEqual) were left as-is.

ULP bounds

Both converted assertions use a ULP constant of 1, which is the measured minimum:

Test case Measured ULP difference Final ULP bound
overflow may be transient 1 1
underflow may be transient 1 1

The bound was tightened agentically, starting high and lowering: the suite passes at 64, 2, and 1, and fails at 0 with exactly the two converted assertions failing, confirming 1 is the minimum required value. The full suite (500 assertions) was run twice at the final bound with identical results, 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.

  • The conversion mirrors the idiom used in the already-merged stats/incr/nanmprod migration, which covers the same two transient overflow/underflow test cases for the NaN-aware variant of this accumulator.
  • make test TESTS_FILTER=".*/stats/incr/mprod/.*" passes 500/500 (run twice).
  • ESLint reports an identical set of findings before and after the change (27 pre-existing messages in both cases, with per-rule counts unchanged), so this change introduces no new lint findings.
  • The lint-editorconfig-files target could not be run in this environment because it downloads the editorconfig-checker binary from a GitHub repository that was not reachable from the sandbox (HTTP 403). The file was instead verified manually against .editorconfig: LF line endings, UTF-8, tab indentation, no trailing whitespace, and a 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. It selected the package, studied the already-merged stats/incr/nanmprod migration as prior art, performed the test conversion, and determined the minimum ULP bound empirically by probing the suite at decreasing values of N.


@stdlib-js/reviewers


Generated by Claude Code

Migrate the `stats/incr/mprod` test suite from relative tolerance
assertions to ULP difference assertions using
`@stdlib/assert/is-almost-same-value`.

Both converted assertions ("overflow may be transient" and "underflow
may be transient") were tightened to a measured minimum of 1 ULP.

Ref: #11352

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

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/incr/mprod $\\color{green}252/252$
$\\color{green}+100.00\\%$
$\\color{green}27/27$
$\\color{green}+100.00\\%$
$\\color{green}3/3$
$\\color{green}+100.00\\%$
$\\color{green}252/252$
$\\color{green}+100.00\\%$

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

This branch has not been deployed

No deployments
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