Skip to content

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

Merged
Planeshifter merged 2 commits into
developfrom
kgryte/ulp-simulate-iter-hann-pulse
Sep 22, 2026
Merged

Planeshifter merged 2 commits into
developfrom
kgryte/ulp-simulate-iter-hann-pulse

Conversation

@kgryte

@kgryte kgryte commented Sep 21, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

  • Migrates simulate/iter/hann-pulse's test/test.js from relative-tolerance (EPS-based) floating-point assertions to ULP-based assertions using @stdlib/assert/is-almost-same-value.
  • Removes the manual delta/tol computations, along with the surrounding if ( actual.value === expected[ i ].value ) { ... } else { ... } guard, in favor of a single t.strictEqual( isAlmostSameValue( actual.value, expected[ i ].value, N ), true, 'returns expected value' ), mirroring the idiom used in previously merged conversions for sibling packages in the same family (e.g., simulate/iter/bartlett-hann-pulse, simulate/iter/flat-top-pulse, simulate/iter/sawtooth-wave).
  • Drops the now-unused abs and EPS requires, and adds the @stdlib/assert/is-almost-same-value require in the same position used by the already-converted sibling packages.
  • Uses the minimum required ULP value for each test block: all 9 converted fixture loops use 0 ULPs.

Measured minimum

The bounds were not guessed. Each assertion site was instrumented to record the actual @stdlib/number/float64/base/ulp-difference between the returned and expected value across every iteration, together with whether every pair was bit-identical under is-same-value:

BLOCK 0 maxulp=0 allexact=true
BLOCK 1 maxulp=0 allexact=true
BLOCK 2 maxulp=0 allexact=true
BLOCK 3 maxulp=0 allexact=true
BLOCK 4 maxulp=0 allexact=true
BLOCK 5 maxulp=0 allexact=true
BLOCK 6 maxulp=0 allexact=true
BLOCK 7 maxulp=0 allexact=true
BLOCK 8 maxulp=0 allexact=true

Every comparison is exactly bit-identical, so 0 is the tightest attainable bound for all 9 sites (isAlmostSameValue dispatches to isSameValue when maxULP === 0, which also distinguishes -0 from +0, so this is the strictest form of the assertion and cannot be lowered further). This matches the bound used by the already-converted sibling packages in this family.

The suite was run twice at the final bounds with identical, fully passing results, confirming there is no FMA/arch-dependent variation.

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.

Verified via:

make test TESTS_FILTER=".*/simulate/iter/hann-pulse/.*"

3281/3281 assertions pass, both before and after the change — the assertion count is unchanged, since the previous if/else guard contributed exactly one assertion per iteration, as does the new single assertion.

eslint run against the changed file using etc/eslint/.eslintrc.tests.js reports no issues. Only test/test.js was changed; this package has no test.native.js.

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

This PR was written by Claude Code (an autonomous coding agent), which searched for a qualifying candidate package, studied prior merged conversions for the same idiom (preferring sibling packages in the same family), performed the migration, and empirically determined the minimum ULP bounds described above by measuring actual ULP differences and confirming determinism through repeated test runs.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01VEteurLjXqZToc9rcqJLbv


Generated by Claude Code

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

stdlib-bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report

No coverage information available.

@Planeshifter
Planeshifter marked this pull request as ready for review September 22, 2026 04:13
@Planeshifter
Planeshifter requested a review from a team September 22, 2026 04:13
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Sep 22, 2026
@Planeshifter

Copy link
Copy Markdown
Member

/stdlib merge

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Sep 22, 2026

@Planeshifter Planeshifter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Sep 22, 2026
@Planeshifter
Planeshifter merged commit 8b6eb86 into develop Sep 22, 2026
15 checks passed
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Sep 22, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants