Repository navigation
Conversation
Migrate the test suite for `constants/float32/ln-half` from a relative tolerance assertion to a ULP difference assertion. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0145oPrciok5CLgLVy5bna7i
|
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:
constants/float32/ln-halffrom a relative tolerance assertion to a ULP difference assertion.The
export equals lnf(0.5)test previously computeddelta = absf( v - FLOAT32_LN_HALF )andtol = EPSand asserted witht.ok( delta <= tol, ... ). It now delegates to@stdlib/number/float32/base/assert/is-almost-same-value:Final ULP constant:
0.test/test.jsNotes on how the bound was measured:
n = 64and stepping down (64, 32, 16, 8, 4, 2, 1, 0). Every probe passes, so0is the measured minimum and no smaller non-negative bound exists.lnf( 0.5 )returns-0.6931471824645996, which is bit-identical to the exported constant-0.6931471824645996;@stdlib/number/float32/base/ulp-differencereports a difference of exactly0ULP. The single-precision variant of the assertion is used here (matching the already-convertedconstants/float32/ln-two,constants/float32/pi-squared, andconstants/float32/half-ln-two) so that the gap is measured in single-precision units.4assertions pass both times.test.native.js, so there is no JS/C divergence to account for.typeofand the exact value check) are intentionally left unchanged, as exact comparisons remain correct there.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 bound is reproducible across architectures: the comparison is between two compile-time-fixed single-precision values and is not subject to FMA-contraction differences.
make eslint-tests TESTS_FILTER=".*/constants/float32/ln-half/.*"andmake test TESTS_FILTER=".*/constants/float32/ln-half/.*"both pass. The changed file was additionally verified for tabs-only indentation, no new trailing whitespace, LF endings, and a final newline.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code. It studied the already-converted packages in the same family (notably
constants/float32/ln-twoandconstants/float16/ln-half) to match the established idiom, then measured the minimum ULP bound empirically and verified determinism as described above.@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_0145oPrciok5CLgLVy5bna7i
Generated by Claude Code