test: migrate stats/base/dists/erlang/skewness to ULP-based assertions - #14022
Merged
Conversation
Migrate the tests for `stats/base/dists/erlang/skewness` from relative tolerance testing to ULP difference testing using `@stdlib/assert/is-almost-same-value`. All 200 fixture values are bit-for-bit exact for both the JavaScript and the C implementations, so the ULP bound is tightened to the measured minimum of 0. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T1qAkJFoiG9eerDmaEhcUC
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
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/base/dists/erlang/skewnessfrom relative tolerance testing (delta = abs( y - expected[i] ),tol = 1.0 * EPS * abs( expected[i] ),t.ok( delta <= tol, ... )) to ULP difference testing using@stdlib/assert/is-almost-same-value.test/test.jsandtest/test.native.js, which mirror one another.@stdlib/math/base/special/absand@stdlib/constants/float64/epsimports from both test files (unlike some other conversions,EPSis not used anywhere else in these files).The ULP bounds were tightened to the measured minimum which passes over the full fixture set, for both the JavaScript and the C implementations:
fixtures/julia/data.json0Notes on how the bound was determined:
0is both the measured maximum and the tightest possible bound.2 / sqrt( k ), and both the JavaScript and C implementations evaluate exactly that expression.sqrtis correctly rounded under IEEE 754 and the subsequent division is a single correctly rounded operation, so there is no room for the two implementations, or the reference values, to diverge.y === expected[i]fast path was taken for every fixture value and the tolerance branch was never exercised.test.jsandtest.native.jsuse identical bounds.test/test.native.jswas exercised against the actual C implementation rather than skipped. Both test files were run twice at the final bounds, with identical results (217 assertions fortest.js, 215 fortest.native.js, all passing, per run).Related Issues
This pull request has the following related issues:
math/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352Questions
Given that every fixture value is bit-for-bit exact, a bound of
0is equivalent to a strict equality check. Reviewers may prefer plaint.strictEqual( y, expected[ i ], ... )here instead;isAlmostSameValue( ..., 0 )was chosen for consistency with the other converted packages, which already use a0bound in 300+ places.Other
make test TESTS_FILTER=".*/stats/base/dists/erlang/skewness/.*"and by runningtest/test.native.jsdirectly against the compiled add-on. Linting is clean via ESLint usingetc/eslint/.eslintrc.tests.js.editorconfigpre-commit hook could not run in this environment, as it downloads its binary from a GitHub repository that this session cannot reach. The two files were instead checked manually against.editorconfig(LF endings, tab indentation, final newline, UTF-8); the diff introduces no new violations.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 test migration follows the idiom established by previously merged conversions, and the ULP bound was measured empirically against both the JavaScript and compiled C implementations rather than guessed.
@stdlib-js/reviewers
Generated by Claude Code