Repository navigation
test: migrate stats/strided/sstdevch to ULP-based assertions - #16073
Merged
Merged
Conversation
Replace the relative tolerance assertions in the package tests with ULP difference assertions, per the migration described in #11352. In `test/test.sstdevch.js`, `test/test.ndarray.js`, `test/test.sstdevch.native.js`, and `test/test.ndarray.native.js`, add a `@stdlib/number/float32/base/assert/is-almost-same-value` require (the single-precision variant, as the package returns single-precision results), remove the now unused `@stdlib/math/base/special/abs` and `@stdlib/constants/float32/eps` requires, and replace the `delta`/`tol` computations with `isAlmostSameValuef`. The ULP bound is `1`, which is the measured minimum; the assertions fail at a bound of `0`. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01De2bMgapTNyqxjdw9XURSE
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
kgryte
marked this pull request as ready for review
October 12, 2026 13:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves a part of #11352.
Description
This pull request:
stats/strided/sstdevchfrom relative tolerance testing to ULP difference testing.Specifically, in
test/test.sstdevch.js,test/test.ndarray.js,test/test.sstdevch.native.js, andtest/test.ndarray.native.js:@stdlib/number/float32/base/assert/is-almost-same-valuerequire (the single-precision variant, as the package returns single-precision results), and removes the now unused@stdlib/math/base/special/absand@stdlib/constants/float32/epsrequires.deltaandtolcomputations, replacingt.strictEqual( delta <= tol, true, ... )witht.strictEqual( isAlmostSameValuef( v, expected, 1 ), true, 'returns expected value' ).This mirrors the already migrated sibling packages
stats/strided/sstdevandstats/base/snanstdevyc, which use the same idiom and the same ULP bound. Only test files are changed; no implementation, documentation, orpackage.jsonchanges were necessary. Exact comparisons (e.g., against0.0,NaN, and intest/test.js) were left as-is.Final ULP constant:
1(used in all four test files, for both the JavaScript and the native assertions).This is the measured minimum. The ULP difference between the returned value and the expected value was measured directly for each of the migrated assertions, for the JavaScript (
lib/sstdevch.js,lib/ndarray.js) and native (lib/sstdevch.native.js,lib/ndarray.native.js) implementations, and is exactly1in every case. Tightening further fails: at an ULP bound of0, the assertions fail; at1, all pass.Verification (locally, with the native add-on built via
NODE_ADDONS_PATTERN="sstdevch" make install-node-addons, so that the*.native.jssuites actually run rather than skip):make test TESTS_FILTER=".*/stats/strided/sstdevch/.*"→ 77 assertions, 77 passing, 0 failing.1with identical results, to confirm there is no FMA/architecture-dependent flakiness.make lint-javascript-tests TESTS_FILTER=".*/stats/strided/sstdevch/.*"(ESLint, usingetc/eslint/.eslintrc.tests.js) is clean on all changed files, as are the license-header and filename lints.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
lint_editorconfigpre-commit check could not be run in this environment, as it attempts to download theeditorconfig-checkerbinary from GitHub and outbound access to that repository was unavailable. The changed files were instead verified manually against.editorconfig(LF line endings, UTF-8, tab indentation, no trailing whitespace, final newline present).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. The agent selected the package, mirrored the migration idiom from the already migrated sibling packages, measured the minimum ULP bound empirically, and verified the tests and lint locally.
@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_01De2bMgapTNyqxjdw9XURSE
Generated by Claude Code