test: migrate stats/base/dists/frechet/variance to ULP-based assertions - #14434
Conversation
…ions Replace the computed relative tolerance comparisons in the fixture loops with `@stdlib/assert/is-almost-same-value` using the minimum required ULP value (66). Ref: #11352
|
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:
stats/base/dists/frechet/variancefrom 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 both
test/test.jsandtest/test.native.js, theif ( y === expected[i] ) { ... } else { delta/tol ... }branch in the fixture loop is replaced with a single assertion:The now-unused
@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires are removed, and@stdlib/assert/is-almost-same-valueis added. No other test cases were touched, and no non-test files were changed.ULP constant:
66in bothtest/test.jsandtest/test.native.js.This is the measured minimum. Over the full Julia fixture set (63 non-
nullcases), the maximum observed ULP difference between the returned and expected values is exactly 66, attained atalpha = 4.728181271575317,s = 3.0858597298664217(returned1.5059173686166538vs. expected1.5059173686166392). The suite passes at66and fails at65, and passes across repeated runs. For reference, the previous relative tolerance was45.0 * EPS.The same constant is used in
test/test.native.js, matching the convention used by the already-migrated sibling packages in this distribution (e.g.stats/base/dists/frechet/kurtosis,mode,entropy).Related Issues
This pull request has the following related issues:
math/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352Questions
The native add-on was not built in the environment used to author this change, so
test/test.native.jswas skipped locally and the66bound there is inherited from the JavaScript measurement (as in the siblingfrechetpackages). Happy to adjust if CI shows a different bound is required for the C implementation.Other
Verification performed:
make test TESTS_FILTER=".*/stats/base/dists/frechet/variance/.*"— 78/78 passing, run twice with identical results.make lint-javascript-tests TESTS_FILTER=".*/stats/base/dists/frechet/variance/.*"— clean (the only remaining diagnostic is a pre-existing cspell warning on "Fréchet", which is also present in the already-migrated sibling packages).git statusconfirms the only changed files are the two test files.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written by Claude Code running as an unattended scheduled task. It mirrored the migration idiom from previously merged
frechetpackages, determined the minimum ULP bound empirically by measuring the maximum ULP difference across the fixture set and confirming the suite passes at 66 and fails at 65, and ran the package test suite and test linter locally.@stdlib-js/reviewers
Generated by Claude Code