Skip to content

test: migrate simulate/iter/periodic-sinc to ULP-based assertions - #15819

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-periodic-sinc
Oct 2, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-periodic-sinc

Conversation

@kgryte

@kgryte kgryte commented Oct 2, 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 simulate/iter/periodic-sinc from relative tolerance assertions to ULP difference assertions, as proposed in [RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue) #11352.
  • replaces the delta/tol comparison idiom in all seventeen fixture loops of test/test.js with t.strictEqual( isAlmostSameValue( actual.value, expected[ i ].value, 0 ), true, 'returns expected value' );.
  • adds the @stdlib/assert/is-almost-same-value require and removes the now-unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires, along with the now-unused delta and tol local declarations.

ULP bounds

The package has one ULP constant, used in all seventeen fixture loops:

Assertion sites Previous tolerance Final ULP bound
all 17 fixture loops in test/test.js 1.0 * EPS * abs( expected ) 0

The bound was measured, not guessed. Each of the 4319 value comparisons across the full fixture set was instrumented to compute the smallest maxULP for which isAlmostSameValue returns true; the measured maximum was 0 for every loop, i.e. the returned values are bit-for-bit identical to the expected values. 0 is therefore both the measured minimum and the tightest representable bound, and it matches the bound already used by the converted sibling package simulate/iter/hann-pulse.

This is expected here: the test's expected values are computed from the same deterministic @stdlib/math/base/special/sinpi and @stdlib/math/base/special/wrap primitives as the implementation, with no PRNG-generated fixtures, so the comparison is reproducible across runs and platforms. The suite was run twice at the final bound, with 8539 of 8539 assertions passing both times and no variation between runs.

Only test/test.js is changed; there is no test/test.native.js for this package, and test/test.validate.js contains no tolerance-based assertions.

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.

Verification performed locally:

  • make test TESTS_FILTER=".*/simulate/iter/periodic-sinc/.*" → 8539 passing, 0 failing (run twice, identical results).
  • make lint-javascript-files FILES="lib/node_modules/@stdlib/simulate/iter/periodic-sinc/test/test.js" ESLINT_CONF="etc/eslint/.eslintrc.tests.js" → 0 errors (one pre-existing @cspell/spellchecker warning for the word "sinc", present before this change).
  • EditorConfig compliance was verified manually (LF endings, UTF-8, tab indentation, final newline, no trailing whitespace), because make lint-editorconfig-files could not run in this environment: editorconfig-checker downloads its binary from the editorconfig-checker/editorconfig-checker GitHub releases, which was unreachable here.

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 Code selected the package, studied the already-converted sibling packages in the same family to mirror the established idiom, applied the mechanical test conversion, measured the minimum ULP bound by instrumenting the fixture comparisons, and ran the tests and linters. It is opened as a draft for human review.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01R9yT3mZZw8YXi2JDjpZKth


Generated by Claude Code

Replace the relative tolerance assertions in the
`simulate/iter/periodic-sinc` tests with ULP difference assertions
using `@stdlib/assert/is-almost-same-value`. All seventeen fixture
loops are exact (0 ULP), as measured over the full fixture set.

Ref: #11352

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

---
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: na
  - 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 the Good First PR A pull request resolving a Good First Issue. label Oct 2, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
simulate/iter/periodic-sinc $\\color{green}381/381$
$\\color{green}+100.00\\%$
$\\color{green}53/53$
$\\color{green}+100.00\\%$
$\\color{green}6/6$
$\\color{green}+100.00\\%$
$\\color{green}381/381$
$\\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 Oct 2, 2026
@kgryte
kgryte marked this pull request as ready for review October 2, 2026 21:06
@kgryte
kgryte requested a review from a team October 2, 2026 21:06
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Oct 2, 2026
@kgryte
kgryte merged commit 8ff7dce into develop Oct 2, 2026
66 checks passed
@kgryte
kgryte deleted the kgryte/ulp-periodic-sinc branch October 2, 2026 21:07
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Oct 2, 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