Skip to content

test: migrate constants/float16/ln-ten to ULP-based assertions - #16130

Merged
kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-ya4w0d
Oct 14, 2026
Merged

kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-ya4w0d

Conversation

@kgryte

@kgryte kgryte commented Oct 14, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

  • migrates the test suite of @stdlib/constants/float16/ln-ten from relative tolerance testing to ULP difference testing.
  • replaces the absf( v - FLOAT16_LN10 ) <= EPS * FLOAT16_LN10 tolerance comparison with isAlmostSameValue( v, FLOAT16_LN10, 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 as constants/float16/half-ln-two).
  • rounds the computed lnf(10) value to half-precision via @stdlib/number/float64/base/to-float16 before comparison, so that the ULP difference is measured in half-precision units.
  • removes the now unused @stdlib/math/base/special/absf and @stdlib/constants/float16/eps requires.

Final ULP constant: 0. Starting from a high bound and tightening, the measured maximum ULP difference between float64ToFloat16( lnf( 10.0 ) ) and the exported constant is 0 (both are bit-identical half-precision values), so 0 is the minimum required ULP value. The package test suite was run repeatedly at the final bound (including via the pre-push hook) and passed deterministically each time.

Only test/test.js is modified; there is no test/test.native.js for this package.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Note that the editorconfig-checker pre-commit step could not run in the authoring environment because its binary is fetched from a GitHub release that was unreachable. The changed file was instead verified manually against .editorconfig (LF line endings, UTF-8, tab indentation, no trailing whitespace, final newline). JavaScript linting with etc/eslint/.eslintrc.tests.js is clean.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

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_01TtYau9K417VTv6oYzKnGzv


Generated by Claude Code

Replace the relative tolerance comparison in the
`constants/float16/ln-ten` test suite with a ULP-based assertion
using `@stdlib/number/float16/base/assert/is-almost-same-value`.
The measured minimum ULP difference is zero, so the assertion
uses `0` ULPs.

Resolves a part of #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TtYau9K417VTv6oYzKnGzv

---
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: na
  - 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
---
@stdlib-bot stdlib-bot added the Good First PR A pull request resolving a Good First Issue. label Oct 14, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
constants/float16/ln-ten $\\color{green}51/51$
$\\color{green}+100.00\\%$
$\\color{green}1/1$
$\\color{green}+100.00\\%$
$\\color{green}0/0$
$\\color{green}+100.00\\%$
$\\color{green}51/51$
$\\color{green}+100.00\\%$

The above coverage report was generated for the changes in this PR.

@kgryte kgryte added the Tests Pull requests specifically adding tests. label Oct 14, 2026
@kgryte
kgryte marked this pull request as ready for review October 14, 2026 09:56
@kgryte
kgryte requested a review from a team October 14, 2026 09:56
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Oct 14, 2026
@kgryte
kgryte merged commit 1a081e7 into develop Oct 14, 2026
66 checks passed
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Oct 14, 2026
@kgryte
kgryte deleted the claude/great-brahmagupta-ya4w0d branch October 14, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Good First PR A pull request resolving a Good First Issue. Tests Pull requests specifically adding tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants