Repository navigation
test: migrate simulate/iter/triangle-wave to ULP-based assertions - #15571
Conversation
Replace relative tolerance comparisons with `isAlmostSameValue` ULP difference assertions. Each assertion site uses the minimum required ULP value, which is `0` throughout, as the returned values are bit-identical to the expected values. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UDitDiLoTNhLZNVBzzdAYE --- 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 ---
|
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! |
Coverage Report
The above coverage report was generated for the changes in this PR. |
Resolves a part of #11352.
Description
This pull request:
simulate/iter/triangle-wavefrom relative tolerance testing to ULP difference testing, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.Specifically, in
test/test.js:@stdlib/assert/is-almost-same-valuerequire and removes the now unused@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires.delta/toldeclarations and thedelta = abs( ... )/tol = 1.0 * EPS * abs( ... )tolerance computations.if ( actual.value === expected[ i ].value ) { ... } else { ... }comparison into a singlet.strictEqual( isAlmostSameValue( actual.value, expected[ i ].value, 0 ), true, 'returns expected value' );assertion.There are 8 converted assertion sites (the seven waveform tests and the iteration-limit test). No other files are touched, and the total assertion count is unchanged at 240.
ULP bound
The final ULP constant is
0at every one of the 8 assertion sites, which is the measured minimum.To determine this, each assertion site was instrumented to search for the smallest
maxULPfor whichisAlmostSameValue( actual.value, expected[ i ].value, n )returnstrue, and the maximum such value over the full fixture set was recorded per site. Every site measured0, meaning the returned values are bit-identical to the expected values (0is the tightest bound the assertion accepts, asmaxULP === 0delegates toisSameValue, so-0/+0remain distinguishable). The suite was then run twice at the final bound to confirm determinism, passing 240/240 both times:This matches the bound used by the already-converted sibling package
simulate/iter/sawtooth-wave, which also uses0for its waveform tests.Related Issues
This pull request has the following related issues:
math/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352Questions
No.
Other
The idiom was mirrored from the already-converted packages in the same family (
simulate/iter/sawtooth-wave,simulate/iter/hann-pulse,simulate/iter/flat-top-pulse), including the placement of theisAlmostSameValuerequire and the inline ULP literal.make lint-javascript-filescannot complete in the authoring environment because theeditorconfig-checkerbinary download is blocked, so that one check was skipped locally; the file was instead verified by hand to be LF-only, tab-indented, free of trailing whitespace, and to end in a final newline. The test-file ESLint configuration (etc/eslint/.eslintrc.tests.js) did run and reported no problems.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code running as an unattended scheduled task. It selected the package, mirrored the conversion idiom from already-converted packages in the same family, applied the test changes, measured the minimum ULP bound empirically, and verified the suite and lint.
@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_01UDitDiLoTNhLZNVBzzdAYE
Generated by Claude Code