test: migrate stats/base/dists/logistic/mgf to ULP-based assertions - #15132
Draft
kgryte wants to merge 1 commit into
Draft
test: migrate stats/base/dists/logistic/mgf to ULP-based assertions#15132kgryte wants to merge 1 commit into
stats/base/dists/logistic/mgf to ULP-based assertions#15132kgryte wants to merge 1 commit into
Conversation
Replace relative tolerance comparisons with `isAlmostSameValue` ULP-based assertions across the package's test files. The bound is tightened to the measured minimum of 3 ULP over the full fixture set. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014tDJcwG5Ru7a73zmYG7pba
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/logistic/mgffrom relative tolerance testing to ULP difference testing.Changes are limited to the package's test files:
test/test.mgf.jstest/test.factory.jstest/test.native.jsIn each fixture loop, the
delta/tolcomputation and they === expected[i]special case are replaced with a single assertion:The
@stdlib/assert/is-almost-same-valuerequire is added, and the now unused@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires are removed. No fixtures, implementations, or test cases were otherwise modified.ULP bound:
3, applied uniformly across all three test files.This is the measured minimum. Maximum observed ULP difference over the full fixture set (3 fixtures x 1000 values, evaluated against both
lib/main.jsandlib/factory.js):positive_mean.jsonnegative_mean.jsonlarge_variance.jsonTightness was confirmed by re-running the suite at lower bounds:
2fails (1 assertion),1fails (156), and0fails (621). The suite was run twice at3with identical results (3011 passing assertions intest.mgf.js, 3017 intest.factory.js, 0 failures), so the bound is not sensitive to run-to-run 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
The C implementation (
src/main.c) mirrors the JS implementation exactly (exp( mu*t ) / sinc( s*t )). Because the Node addon was not built in the environment used to prepare this PR,test/test.native.jsskipped locally. To avoid guessing at the native bound, the C routine was compiled into a standalone harness and evaluated against the same fixtures; it agrees with the JS implementation and also peaks at 3 ULP, which is whytest.native.jsuses the same constant.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, the ULP bound measurement, and this description were produced by Claude Code; the ULP bound was determined empirically by measuring the fixture set and verifying that lower bounds fail.
@stdlib-js/reviewers
Generated by Claude Code