test: migrate stats/base/dists/laplace/logcdf to ULP-based assertions - #14141
Conversation
Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011B4fs8EPgjzfB41xou4sDQ
|
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/laplace/logcdffrom relative tolerance testing to ULP difference testing, replacing thedelta/tolcomparisons intest/test.logcdf.js,test/test.factory.js, andtest/test.native.jswithisAlmostSameValue.@stdlib/assert/is-almost-same-valueimport and removes the now unused@stdlib/constants/float64/epsand@stdlib/math/base/special/absimports.Final ULP constant:
0for every fixture group, in all three test files.The ULP bound was measured rather than guessed: for every fixture value, the minimum ULP difference which admits the computed result was computed directly (searching upward from
0), and the maximum over the full fixture set was taken. Both the JavaScript and C implementations reproduce every Julia fixture value exactly, so the measured minimum is0ULP — the tightest bound expressible — for all of:positive_mean1.0*EPSnegative_mean1.0*EPSlarge_variance1.0*EPStest/test.native.jswas verified against a locally compiled add-on (make install-node-addons NODE_ADDONS_PATTERN='laplace/logcdf') so that it did not skip; the0ULP bound is therefore measured for the C implementation as well, not merely inherited from the JavaScript results. Each suite was run twice at the final bound to confirm determinism (no FMA/architecture variation); all assertions pass on every run (test.logcdf.js: 3013,test.factory.js: 3018,test.native.js: 3013,test.js: 3).Only the three test files are changed; the implementation and fixtures are untouched.
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
Opened as a draft pending maintainer review of the
0ULP bound. A bound of0requires bit-for-bit agreement with the fixtures; there is existing precedent in the repo (stats/base/dists/weibull/logcdf,stats/base/dists/uniform/entropy,math/base/special/covercos, andmath/base/special/asecall use0for fixture groups which match exactly), and the results here are deterministic IEEE-754 in both the JavaScript and C implementations. If maintainers would prefer a1ULP margin intest/test.native.jsas a hedge against compiler/architecture variation in the C build, that is a one-character change.Two environment notes, neither affecting the diff:
editorconfig-checkerstage of the local pre-commit hook could not run, because it downloads its binary from a GitHub release which was not reachable from this environment. EditorConfig conformance was instead verified manually for the changed files (LF line endings, UTF-8, tab indentation, no trailing whitespace introduced, final newline present), andmake eslint-tests TESTS_FILTER=".*/stats/base/dists/laplace/logcdf/.*"passes cleanly.make install-node-modulesfails in this environment because two transitive dependencies request registry versions which are not resolvable here (es-object-atoms@^1.1.2,hasown@^2.0.4; the registry as seen from this environment publishes at most1.1.1and2.0.2respectively). Installing with temporary localoverridespinning those two shims produced a working toolchain; the override was reverted before committing and is not part of this pull request. Flagging it in case CI hits the same resolution failure.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 selected the package, studied prior conversions in the repo to match the established idiom, applied the test migration, measured the minimum ULP bound empirically, and verified tests and linting locally.
@stdlib-js/reviewers
Generated by Claude Code