Skip to content

test: migrate simulate/iter/bartlett-hann-pulse to ULP-based assertions - #14614

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-simulate-iter-bartlett-hann-pulse
Aug 25, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-simulate-iter-bartlett-hann-pulse

Conversation

@kgryte

@kgryte kgryte commented Aug 25, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

Note that the @stdlib/math/base/special/abs require is retained, as abs remains in use by the bartlettHann reference implementation defined within the test file. The package has no test/test.native.js, so test/test.js is the only test file requiring migration.

ULP bound: 0, the measured minimum over the full set of generated values.

The bound was determined empirically rather than assumed. Instrumenting @stdlib/number/float64/base/ulp-difference over every value produced by all nine waveform test cases (the default waveform, the period, duration, amplitude, and four offset variants, and the iter-limited case; 1604 generated values in total) yields a maximum ULP difference of 0: every returned value is bit-identical to the reference value computed within the test file. Starting from a high bound and tightening downward therefore terminates at 0, which is the minimum admissible non-negative bound and cannot be tightened further.

This result is expected rather than incidental. Unlike the math/base/special conversions, the expected values here are not external fixtures but are computed in the test file by a bartlettHann helper that mirrors the private bartlettHann in lib/main.js operation for operation, including the shared cospi call. Both sides therefore evaluate an identical sequence of IEEE-754 double-precision operations on identical inputs, and agreement is exact regardless of the accuracy of cospi itself. The previous 1.0 * EPS * abs( expected[ i ] ) tolerance branch was consequently never exercised; the migration preserves the strictness of the original assertions rather than loosening them.

The suite was run twice at the final bound with identical results (3281/3281 passing in each run), so the bound is not sensitive to run-to-run variation. A bound of 0 is consistent with sibling conversions under #11352 whose values likewise agree exactly (for example, math/base/special/coversin and math/base/special/asecf).

Only test/test.js is modified; no implementation, fixture, or documentation changes are included.

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?

Yes, one. This package sits outside math/base/special, which is the family named in the #11352 tracking issue, although it uses exactly the relative tolerance idiom the RFC targets and other packages outside that family have already been migrated under the same issue. If migrations outside math/base/special are not wanted at this time, please close this PR and no further such packages will be proposed.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Notes on local verification:

  • make install-node-modules failed in this environment because es-object-atoms@^1.1.2, required by string.prototype.trim@1.2.11, string.prototype.trimend@1.0.10, and es-abstract-get@1.0.0, does not resolve against the registry (the highest published version is 1.1.1). Installing with a temporary overrides entry pinning es-object-atoms to 1.1.1 succeeded; package.json was restored to its committed state before committing and is not part of this diff.
  • make test TESTS_FILTER=".*/simulate/iter/bartlett-hann-pulse/.*" passes (3281/3281), run twice.
  • make lint-javascript-tests TESTS_FILTER=".*/simulate/iter/bartlett-hann-pulse/.*" reports no problems for either test/test.js or test/test.validate.js.
  • make lint-editorconfig-files could not execute because the editorconfig-checker binary download is blocked in this environment. The changed file was instead checked manually for indentation (tabs), trailing whitespace, line endings (LF), character set, and final newline, and matches the surrounding files.

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 studied previously merged conversions under #11352 to match the established idiom, applied the migration, measured the minimum ULP bound empirically over every generated value, and verified that the tests pass and that the files lint cleanly.


@stdlib-js/reviewers


Generated by Claude Code

@stdlib-bot stdlib-bot added the Good First PR A pull request resolving a Good First Issue. label Aug 25, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Hello! 👋

We've noticed that you've been opening a number of PRs addressing good first issues. Thank you for your interest and enthusiasm!

Now that you've made a few contributions, we suggest no longer working on good first issues. Instead, we encourage you to prioritize cleaning up any PRs which have yet to be merged and then proceed to work on more involved tasks.

Not only does this ensure that other new contributors can work on things and get ramped up on all things stdlib, it also ensures that you can spend your time on more challenging problems. 🚀

For ideas for future PRs, feel free to search the codebase for TODOs and FIXMEs and be sure to check out other open issues on the issue tracker. Cheers!

@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
simulate/iter/bartlett-hann-pulse $\\color{green}343/343$
$\\color{green}+100.00\\%$
$\\color{green}44/44$
$\\color{green}+100.00\\%$
$\\color{green}6/6$
$\\color{green}+100.00\\%$
$\\color{green}343/343$
$\\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 25, 2026
@kgryte
kgryte marked this pull request as ready for review August 25, 2026 11:01
@kgryte
kgryte requested a review from a team August 25, 2026 11:01
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 25, 2026
@kgryte
kgryte merged commit 5656376 into develop Aug 25, 2026
66 checks passed
@kgryte
kgryte deleted the kgryte/ulp-simulate-iter-bartlett-hann-pulse branch August 25, 2026 11:02
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 25, 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. Tests Pull requests specifically adding tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants