Repository navigation
test: migrate simulate/iter/bartlett-hann-pulse to ULP-based assertions - #14614
Conversation
|
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/bartlett-hann-pulsefrom relative tolerance testing to ULP difference testing, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.delta/tolcomparison blocks intest/test.jswitht.strictEqual( isAlmostSameValue( actual.value, expected[ i ].value, 0 ), true, 'returns expected value' );, adding the@stdlib/assert/is-almost-same-valuerequire and dropping the now unused@stdlib/constants/float64/epsrequire.Note that the
@stdlib/math/base/special/absrequire is retained, asabsremains in use by thebartlettHannreference implementation defined within the test file. The package has notest/test.native.js, sotest/test.jsis the only test file requiring migration.ULP bound:
0, the measured minimum over the full set of generated values.The bound was determined empirically rather than assumed. Instrumenting
@stdlib/number/float64/base/ulp-differenceover every value produced by all nine waveform test cases (the default waveform, theperiod,duration,amplitude, and fouroffsetvariants, and theiter-limited case; 1604 generated values in total) yields a maximum ULP difference of0: every returned value is bit-identical to the reference value computed within the test file. Starting from a high bound and tightening downward therefore terminates at0, which is the minimum admissible non-negative bound and cannot be tightened further.This result is expected rather than incidental. Unlike the
math/base/specialconversions, the expected values here are not external fixtures but are computed in the test file by abartlettHannhelper that mirrors the privatebartlettHanninlib/main.jsoperation for operation, including the sharedcospicall. Both sides therefore evaluate an identical sequence of IEEE-754 double-precision operations on identical inputs, and agreement is exact regardless of the accuracy ofcospiitself. The previous1.0 * EPS * abs( expected[ i ] )tolerance branch was consequently never exercised; the migration preserves the strictness of the original assertions rather than loosening them.The suite was run twice at the final bound with identical results (3281/3281 passing in each run), so the bound is not sensitive to run-to-run variation. A bound of
0is consistent with sibling conversions under #11352 whose values likewise agree exactly (for example,math/base/special/coversinandmath/base/special/asecf).Only
test/test.jsis modified; no implementation, fixture, or documentation changes are included.Related Issues
This pull request has the following related issues:
math/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352Questions
Yes, one. This package sits outside
math/base/special, which is the family named in the #11352 tracking issue, although it uses exactly the relative tolerance idiom the RFC targets and other packages outside that family have already been migrated under the same issue. If migrations outsidemath/base/specialare not wanted at this time, please close this PR and no further such packages will be proposed.Other
Notes on local verification:
make install-node-modulesfailed in this environment becausees-object-atoms@^1.1.2, required bystring.prototype.trim@1.2.11,string.prototype.trimend@1.0.10, andes-abstract-get@1.0.0, does not resolve against the registry (the highest published version is1.1.1). Installing with a temporaryoverridesentry pinninges-object-atomsto1.1.1succeeded;package.jsonwas restored to its committed state before committing and is not part of this diff.make test TESTS_FILTER=".*/simulate/iter/bartlett-hann-pulse/.*"passes (3281/3281), run twice.make lint-javascript-tests TESTS_FILTER=".*/simulate/iter/bartlett-hann-pulse/.*"reports no problems for eithertest/test.jsortest/test.validate.js.make lint-editorconfig-filescould not execute because theeditorconfig-checkerbinary download is blocked in this environment. The changed file was instead checked manually for indentation (tabs), trailing whitespace, line endings (LF), character set, and final newline, and matches the surrounding files.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 studied previously merged conversions under #11352 to match the established idiom, applied the migration, measured the minimum ULP bound empirically over every generated value, and verified that the tests pass and that the files lint cleanly.
@stdlib-js/reviewers
Generated by Claude Code