test: migrate stats/base/dists/logistic/pdf to ULP-based assertions - #15024
Merged
Conversation
Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N5UvaSs85zP3Le1hoAaHvK
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
kgryte
commented
Sep 6, 2026
kgryte
commented
Sep 6, 2026
kgryte
commented
Sep 6, 2026
kgryte
commented
Sep 6, 2026
kgryte
commented
Sep 6, 2026
kgryte
commented
Sep 6, 2026
Co-authored-by: Athan <kgryte@gmail.com> Signed-off-by: Athan <kgryte@gmail.com>
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/pdffrom relative tolerance testing (delta/tolcomputed fromEPS) to ULP difference testing using@stdlib/assert/is-almost-same-value.test/test.pdf.js,test/test.factory.js, andtest/test.native.js. No other files are changed, and no source, benchmark, example, or documentation files are touched.The ULP bound used in every migrated assertion is 4, and this is the measured minimum. Across all three Julia fixture sets (
positive_mean,negative_mean,large_variance; 2980 compared values after applying the existingnull/underflow guards), the maximum observed ULP difference between the returned value and the expected value is exactly 4, for both the main export and the function returned byfactory. Lowering the bound to 3 produces 14 failures; 4 is therefore the tightest integer bound that passes over the full fixture set.The previous per-loop tolerances were
3.0 * EPSfor the positive-/negative-mean fixtures and3.0 * EPSfor the large-variance fixture, so the new bound is a comparable, and in ULP terms tighter and better-defined, accuracy budget.The full package test suite (6002 assertions) passes, and was run twice at the final bound with identical results, 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
test/test.native.jsis skipped locally because the native add-on was not built in this environment. To avoid guessing at the bound for the C implementation,src/main.cwas compiled directly against its declared dependency closure and evaluated over the same fixtures: the maximum ULP difference is also 4 at-O0,-O2,-O3, and-O3 -ffp-contract=fast -march=native(i.e., with FMA contraction enabled), so the same bound of 4 is used intest/test.native.js. Reviewers may wish to confirm this against a real add-on build.Other
expected[i] !== nulland!(expected[i] === 0.0 && y < EPS)) are preserved unchanged, so the set of compared values is exactly the same as before. TheEPSimport is retained for those guards; the now-unusedabsimport is replaced by theisAlmostSameValueimport.stats/base/dists/levy/pdf(test: migratestats/base/dists/levy/pdfto ULP-based assertions #14985).Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written by Claude Code, running unattended as a scheduled task. The ULP bound was determined empirically by measuring the maximum ULP difference over the full fixture set rather than by guessing, and was verified by confirming that the next lower bound fails.
@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_01N5UvaSs85zP3Le1hoAaHvK
Generated by Claude Code