Skip to content

test: migrate constants/float64/ln-sqrt-two-pi to ULP-based assertions - #16211

Draft
kgryte wants to merge 1 commit into
developfrom
claude/great-brahmagupta-nbzh6m
Draft

kgryte wants to merge 1 commit into
developfrom
claude/great-brahmagupta-nbzh6m

Conversation

@kgryte

@kgryte kgryte commented Oct 17, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

Specifically, in test/test.js:

  • adds the @stdlib/assert/is-almost-same-value require.
  • removes the now unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires.
  • removes the delta/tol tolerance computation and replaces t.ok( delta <= tol, ... ) with t.strictEqual( isAlmostSameValue( v, LN_SQRT_TWO_PI, 1 ), true, 'returns expected value' ).

The package has no test/test.native.js, so test/test.js is the only changed file.

Final ULP constant: 1. This is the measured minimum. ln( sqrt( TWO_PI ) ) evaluates to 0.91893853320467266954, while the exported constant is 0.91893853320467278056 — a difference of exactly one ULP, so the assertion fails at 0 and passes at 1. The bound was found by starting high and tightening down to the smallest passing integer, and the suite was run twice at 1 to confirm the result is deterministic (no FMA/architecture-dependent variation).

This change mirrors the idiom established in the sibling package constants/float32/ln-sqrt-two-pi (#16155), which used 0 because its single-precision computation happens to be exact.

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.

Verification performed:

  • make test TESTS_FILTER=".*/constants/float64/ln-sqrt-two-pi/.*" — 4/4 passing, run twice at the final ULP value.
  • The same suite at 0 fails (1 failing), confirming 1 is the minimum.
  • make lint-javascript-tests TESTS_FILTER=".*/constants/float64/ln-sqrt-two-pi/.*" — clean.
  • Filename lint — clean.

One note for reviewers: the lint-editorconfig-files step could not be executed in the environment used to author this change, because the editorconfig-checker binary is fetched from GitHub releases at runtime and that download was not permitted. The EditorConfig rules applicable to *.js were instead verified by hand on the changed file (LF line endings, UTF-8, tab indentation, no trailing whitespace, final newline present). Please re-run that step in CI.

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 authored by Claude Code running as an unattended scheduled task. Claude selected the package, mirrored the idiom from already-merged conversions in the same family, performed the edit, and measured the minimum ULP bound empirically.


@stdlib-js/reviewers


Generated by Claude Code

Replaces relative tolerance assertions with ULP difference assertions
using `@stdlib/assert/is-almost-same-value`. The minimum required ULP
value is 1.

Ref: #11352

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
constants/float64/ln-sqrt-two-pi $\\color{green}52/52$
$\\color{green}+100.00\\%$
$\\color{green}1/1$
$\\color{green}+100.00\\%$
$\\color{green}0/0$
$\\color{green}+100.00\\%$
$\\color{green}52/52$
$\\color{green}+100.00\\%$

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants