Repository navigation
test: migrate constants/float16/ln-half to ULP-based assertions - #16173
Merged
Merged
Conversation
Migrate the test suite from relative tolerance testing to ULP difference testing, per the idiom established by sibling packages such as `constants/float16/ln-ten` and `constants/float16/half-ln-two`. The computed `lnf(0.5)` value is rounded to half-precision via `@stdlib/number/float64/base/to-float16` so that the ULP difference is measured in half-precision units. The measured minimum required ULP value is 0 (the values are bit-identical). Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vc6LdYTvcSnCUo61MorWP6
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:
@stdlib/constants/float16/ln-halffrom relative tolerance testing to ULP difference testing.absf( v - FLOAT16_LN_HALF ) <= EPStolerance comparison withisAlmostSameValue( v, FLOAT16_LN_HALF, 0 ), using@stdlib/number/float16/base/assert/is-almost-same-value(the half-precision assertion utility, matching the idiom already used by sibling packages such asconstants/float16/ln-tenandconstants/float16/half-ln-two).lnf(0.5)value to half-precision via@stdlib/number/float64/base/to-float16before comparison, so that the ULP difference is measured in half-precision units.@stdlib/math/base/special/absfand@stdlib/constants/float16/epsrequires.Final ULP constant:
0. Starting from a high bound (64) and tightening (64→16→4→1→0), the measured maximum ULP difference betweenfloat64ToFloat16( lnf( 0.5 ) )and the exported constant is0— both are the bit-identical half-precision value-0.693359375— so0is the minimum required ULP value. The package test suite was run twice at the final bound and passed deterministically both times (4 passing, 0 failing).Only
test/test.jsis modified; there is notest/test.native.jsfor this package.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
JavaScript linting of the changed file with
etc/eslint/.eslintrc.tests.jsis clean. Note thatmake lint-javascriptlints the fullsrctree and currently reports a pre-existing, unrelated error inetc/typedoc/theme/assets/js/theme.js; that file is untouched by this pull request. The changed file was additionally verified against.editorconfig(LF line endings, UTF-8, tab indentation, no trailing whitespace, final newline).Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written primarily by Claude Code, which located the package, mirrored the conversion idiom from already-migrated sibling packages, measured the minimum ULP bound, and ran the tests and linters.
@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_01Vc6LdYTvcSnCUo61MorWP6
Generated by Claude Code