Skip to content

test: migrate simulate/iter/sine-wave to ULP-based assertions - #16259

Draft
kgryte wants to merge 1 commit into
developfrom
claude/great-brahmagupta-tvmpar
Draft

kgryte wants to merge 1 commit into
developfrom
claude/great-brahmagupta-tvmpar

Conversation

@kgryte

@kgryte kgryte commented Oct 19, 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 test suite for simulate/iter/sine-wave from relative tolerance testing to ULP difference testing using @stdlib/assert/is-almost-same-value.
  • replaces each if ( actual.value === expected[ i ].value ) { ... } else { delta/tol ... } comparison with a single t.strictEqual( isAlmostSameValue( actual.value, expected[ i ].value, 0 ), true, 'returns expected value' );.
  • removes the now unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires, along with the now unused delta and tol local variables.

ULP bound

All 7 comparison sites use a ULP bound of 0, which is the measured minimum.

To determine the bound, each comparison was instrumented to compute the smallest maxULP for which isAlmostSameValue returns true (via exponential growth followed by a binary search), and the maximum such value was taken across the full set of expected values at each site. Every site reported a minimum of 0; i.e., the generated waveform values match the expected values exactly, so no non-zero accuracy budget is required. The suite was then run twice at the final bound to confirm determinism.

This matches the bound already used by the previously migrated sibling package simulate/iter/cosine-wave, whose test suite has the same structure.

Verification

  • make test TESTS_FILTER=".*/simulate/iter/sine-wave/.*" → 231 passing, 0 failing (run twice, identical results).
  • ESLint clean using etc/eslint/.eslintrc.tests.js.
  • Only test files are modified; no source, documentation, benchmark, or fixture changes.

Related Issues

Does this pull request have any related issues?

No.

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 expected values in this suite were already matched exactly by the implementation, so the previous relative tolerance branch was never exercised. Migrating to a 0 ULP bound therefore preserves the existing test behavior while expressing the accuracy requirement in ULPs.

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 pull request was authored by Claude Code running as an unattended scheduled task. It studied #11352 and the already migrated sibling package simulate/iter/cosine-wave to match the established idiom, applied the migration, determined the minimum ULP bound empirically by instrumenting the comparisons, and verified the result with the package test suite and ESLint.


@stdlib-js/reviewers


Generated by Claude Code

Replaces relative tolerance comparisons in the test suite with
`@stdlib/assert/is-almost-same-value` ULP difference assertions, mirroring
the already migrated sibling package `simulate/iter/cosine-wave`.

All seven comparison sites were tightened to the measured minimum of `0`
ULP (i.e., the generated waveform values match the expected values
exactly), and the suite was run twice to confirm determinism.

Ref: #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ph1q1qvMPF9P3enTZvGwaT
@stdlib-bot stdlib-bot added the Good First PR A pull request resolving a Good First Issue. label Oct 19, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
simulate/iter/sine-wave $\\color{green}300/300$
$\\color{green}+100.00\\%$
$\\color{green}32/32$
$\\color{green}+100.00\\%$
$\\color{green}5/5$
$\\color{green}+100.00\\%$
$\\color{green}300/300$
$\\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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants