Repository navigation
test: migrate math/base/special/expm1rel to ULP-based assertions - #13982
Merged
Merged
Conversation
Migrates the tests for `math/base/special/expm1rel` from relative tolerance (`EPS`-scaled) assertions to ULP-based assertions using `@stdlib/assert/is-almost-same-value`. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VXgZDZZDJZ92eUM4AwD1Cu --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: skipped - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
kgryte
marked this pull request as ready for review
August 6, 2026 16:27
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:
math/base/special/expm1relfrom relative tolerance (EPS-scaled) assertions to ULP-based assertions using@stdlib/assert/is-almost-same-value, matching the idiom used by previously converted double-precision packages (e.g.,hypot,ellipk,expit,cphase).test/test.jsandtest/test.native.js, removing theabsimport and thedelta/tolcomputations in favor oft.strictEqual( isAlmostSameValue( v, expected[ i ], N ), true, 'returns expected value' );. TheEPSimport is retained in both files, as it is still used by the "returns1.0near0.0" test.Final ULP constants (per fixture set, identical in
test/test.jsandtest/test.native.js):medium_negative.json0medium_positive.json2x = 87.55771771771771,y = 1.2121021459952258e+36, expected1.2121021459952261e+36small_negative.json3x = -0.22922922922922928,y = 0.8936633379449439, expected0.8936633379449436small_positive.json3x = 0.4644644644644645,y = 1.2727816274388977, expected1.272781627438897tiny.json0The previous tolerance was a uniform
3.0 * EPS * abs( expected[ i ] )for every fixture set.The bounds were tightened empirically rather than guessed. Starting from a high bound and lowering it, the measured maximum ULP distance was computed for every one of the 5000 fixture points, and the values above are the minima: lowering the
2to1and the3s to2produces 21 failing assertions, while at the stated bounds all 5008 assertions pass.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
medium_negativeandtinyfixture sets are reproduced exactly (0 ULP). Reviewers may prefer a floor of1there for robustness against future implementation changes;0is used here as it is the measured minimum, consistent with the guidance in #11352 and with the ~300 existingisAlmostSameValue( ..., 0 )assertions already in the tree.Other
test/test.native.jsskipped locally. To avoid guessing its bounds, the C implementation (src/main.c, plus itsexpm1/abs/is_nandependencies) was compiled standalone withgcc -O2and evaluated over the same fixture points: the C implementation reproduces the JavaScript results bit-for-bit, giving identical per-set bounds of0,2,3,3,0. The two test files therefore use the same constants. Confirmation from CI (where the add-on is built) would be welcome.etc/eslint/.eslintrc.tests.js) reports no errors or warnings for either file; the pre-commit JavaScript test lint and filename lint hooks both passed.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code as part of an automated, unattended run: it selected the package, studied the idiom used in previously merged conversions, applied the test edits, and measured the minimum passing ULP bounds by running the suite.
@stdlib-js/reviewers
Generated by Claude Code