Skip to content

test: migrate simulate/iter/cosine-wave to ULP-based assertions - #15592

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-simulate-iter-cosine-wave
Sep 27, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-simulate-iter-cosine-wave

Conversation

@kgryte

@kgryte kgryte commented Sep 27, 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/cosine-wave from relative tolerance assertions to ULP-based assertions, per the guidance in [RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue) #11352.
  • replaces each delta/tol comparison in test/test.js with t.strictEqual( isAlmostSameValue( actual.value, expected[ i ].value, 0 ), true, 'returns expected value' );, adding the @stdlib/assert/is-almost-same-value require and removing the now-unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires along with the delta and tol declarations.

All seven converted assertion sites use a ULP bound of 0. The bound was tightened agentically: starting from 64, the suite was re-run while lowering the value, and 0 is the measured minimum — the accumulated values are bit-identical to the expected values across the full fixture set, so no nonzero budget is required. The suite was run twice at the final bound to confirm determinism (231 assertions passing on both runs, no FMA/arch variation). 0 also matches the bound the sibling packages simulate/iter/sawtooth-wave and simulate/iter/triangle-wave settled on.

The package has no test/test.native.js, and test/test.validate.js contains no tolerance math, so test/test.js is the only file changed.

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 established in 4a73a48 (simulate/iter/triangle-wave) and the simulate/iter/sawtooth-wave conversion: an inline ULP literal rather than a named constant, and the 'returns expected value' message on every case.

Verification performed locally:

  • make test TESTS_FILTER=".*/simulate/iter/cosine-wave/.*" — 231 assertions passing (run twice at the final bound).
  • make lint-javascript-tests TESTS_FILTER=".*/simulate/iter/cosine-wave/.*" — clean.
  • make lint-editorconfig-files could not run in this environment, as it downloads the editorconfig-checker release binary and outbound access to that host was blocked. Compliance was instead verified manually for the changed file: 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 written primarily by Claude Code, running unattended as a scheduled task. It studied #11352 and the prior simulate/iter/sawtooth-wave and simulate/iter/triangle-wave conversions to mirror the established idiom, performed the mechanical substitution, and searched for the minimum passing ULP bound by re-running the test suite.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_012FeJjoxKgvZczJEKgkvTwY


Generated by Claude Code

Ref: #11352

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

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
simulate/iter/cosine-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.

@kgryte kgryte added the Tests Pull requests specifically adding tests. label Sep 27, 2026
@kgryte
kgryte marked this pull request as ready for review September 27, 2026 21:59
@kgryte
kgryte requested a review from a team September 27, 2026 21:59
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Sep 27, 2026
@kgryte
kgryte merged commit 19f0185 into develop Sep 27, 2026
66 checks passed
@kgryte
kgryte deleted the kgryte/ulp-simulate-iter-cosine-wave branch September 27, 2026 22:00
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Sep 27, 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