Conversation
…ssertions Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CZ7vpqkikdfeYSUS4DhSWX
|
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:
math/iter/sequences/continued-fraction'stest/test.jsfrom relative-tolerance (EPS-based) floating-point assertions to ULP-based assertions using@stdlib/assert/is-almost-same-value.delta/tolcomputations (delta = abs( v - expected ); tol = 1.3 * EPS * abs( expected );) in favor of a singlet.strictEqual( isAlmostSameValue( v, expected, 2 ), true, 'returns expected value' )at each of the four fixture loops.absandEPSrequires, and adds the@stdlib/assert/is-almost-same-valuerequire in the same position used by already-converted iterator packages (e.g.,simulate/iter/flat-top-pulse,simulate/iter/bartlett-hann-pulse).Preserved behavior
Each converted loop is guarded by
if ( v === expected || i === terms.length-1 ). Unlike the simpleif ( actual === expected )guards seen in some sibling conversions, this guard is not redundant withisAlmostSameValue: thei === terms.length-1clause requires the final convergent to be exactly equal to the reference value. The guard is therefore retained, and only theelse(tolerance) branch is migrated, so the assertion semantics are unchanged. This mirrors conversions which keep meaningful guards, such asmath/base/special/acsch(if ( expected[ i ] === null ) { ... } else { isAlmostSameValue( ... ) }).Measured minimum
The bound was not guessed. Each assertion site was instrumented to record the actual
@stdlib/number/float64/base/ulp-differencebetween the returned and expected value across every iteration:A downward sweep over the suite confirms 2 is the tightest integer bound that passes:
This is consistent with the tolerance it replaces:
1.3 * EPS * abs( expected )corresponds to roughly 1.3–2.6 ULPs depending on where the expected value falls within its binade, so a 2 ULP budget is no looser than the original assertion.The suite was run twice at the final bound with identical, fully passing results, confirming there is no FMA/arch-dependent variation.
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
4206/4206 assertions in
test/test.jspass, both before and after the change — the assertion count is unchanged, since the previousif/elsebranches contributed exactly one assertion per iteration, as do the new ones.test/test.validate.js(48/48) is unaffected and was left alone; this package has notest.native.js.eslintrun against the changed file usingetc/eslint/.eslintrc.tests.jsreports no errors (the singlemax-lineswarning is pre-existing and this change reduces the file's length). Onlytest/test.jswas changed.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
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, performed the migration, and empirically determined the minimum ULP bound 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_01CZ7vpqkikdfeYSUS4DhSWX
Generated by Claude Code