Skip to content

test: migrate math/base/special/hypot to ULP-based assertions - #13926

Merged
kgryte merged 1 commit into
developfrom
philipp/ulp-hypot
Aug 5, 2026
Merged

test: migrate math/base/special/hypot to ULP-based assertions#13926
kgryte merged 1 commit into
developfrom
philipp/ulp-hypot

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

  • migrates test/test.js and test/test.native.js of math/base/special/hypot from relative-tolerance (EPS-based) assertions to ULP-difference assertions via @stdlib/assert/is-almost-same-value, using the minimum required ULP value.
  • the only tolerance-based block in either file is the 'the function computes the hypotenuse' test, which iterates over the ./fixtures/julia/data.json fixture (2003 cases). Direct ULP-difference computation over the fixture (via @stdlib/number/float64/base/ulp-difference), using both the JavaScript implementation and a locally built native add-on, shows a maximum measured difference of 2 ULPs for both. N = 1 was confirmed to fail (16 of 2003 fixture cases), so 2 is the minimum integer bound for which all cases pass.
  • the 'the function computes the hypotenuse (canonical inputs)' block and all other test blocks in both files already use exact t.strictEqual comparisons on exactly-representable values and are left unchanged, per the demonstrated idiom in the tracking issue.
  • removes the now-unused EPS and abs requires and delta/tol variables.

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.

Both the JavaScript and native (test.native.js, run against a locally built add-on) test suites pass in full (2031 assertions each), run twice at the final ULP bound to confirm determinism (no FMA/arch flakiness observed).

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 an automated Claude Code agent running as a scheduled routine: it selected an unconverted package, studied the merged prior art for this migration (e.g. math/base/special/hypotf, math/base/special/pow, math/base/special/acosh), performed the ULP-difference migration, and empirically determined the minimum ULP bound by direct measurement against the fixture data (including building and testing against a native add-on), with the bound and its determinism independently re-verified before opening this PR.


@stdlib-js/reviewers


Generated by Claude Code

Resolves a part of #11352.

---
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
---
@stdlib-bot stdlib-bot added Good First PR A pull request resolving a Good First Issue. Math Issue or pull request specific to math functionality. labels Aug 5, 2026
@Planeshifter
Planeshifter marked this pull request as ready for review August 5, 2026 01:03
@Planeshifter
Planeshifter requested review from a team and kgryte August 5, 2026 01:03
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 5, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/hypot $\\color{green}182/182$
$\\color{green}+100.00\\%$
$\\color{green}19/19$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}182/182$
$\\color{green}+100.00\\%$

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

@kgryte kgryte added Tests Pull requests specifically adding tests. and removed Needs Review A pull request which needs code review. labels Aug 5, 2026
@kgryte
kgryte merged commit b43a065 into develop Aug 5, 2026
88 checks passed
@kgryte
kgryte deleted the philipp/ulp-hypot branch August 5, 2026 06:49
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. Math Issue or pull request specific to math functionality. Tests Pull requests specifically adding tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants