Skip to content

test: migrate math/base/special/cphase to ULP-based assertions - #13969

Merged
kgryte merged 1 commit into
developfrom
philipp/ulp-cphase
Aug 6, 2026
Merged

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

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 the math/base/special/cphase test suite from the old computed-tolerance idiom (delta/tol derived from EPS) to ULP-based assertions using @stdlib/assert/is-almost-same-value, per [RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue) #11352.
  • Converted files: test/test.js and test/test.native.js. Both files contained three fixture-loop assertions (positive_positive.json, negative_positive.json, negative_negative.json) using delta <= tol comparisons.
  • ULP bounds: isAlmostSameValue( actual, expected[i], 1 ) for the "re and im positive" group, and isAlmostSameValue( actual, expected[i], 2 ) for the "re negative, im positive" and "re and im negative" groups.
  • The bounds were found by computing the exact ULP difference (@stdlib/number/float64/base/ulp-difference) between actual and expected values across the full fixture set (5001 + 1001 + 1001 = 7003 evaluations). The measured maximum ULP difference per group was 1, 2, and 2 respectively — matching the prior EPS multipliers (1.0 * EPS, 2.0 * EPS, 2.0 * EPS) exactly.
  • The full JS test suite was run twice at these bounds to confirm deterministic results (no FMA/arch flakiness): 7052/7052 assertions passing both runs.

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.

  • test/test.native.js was converted to mirror the JS test file exactly, but the native addon could not be built in this sandboxed session, so the (skip-gated) native tests did not execute here.
  • Only test files were changed; package.json did not need updates, as @stdlib/assert/is-almost-same-value resolves via existing monorepo module resolution (consistent with other converted packages).
  • npx eslint is clean on both changed files.
  • The pre-commit hook's EditorConfig check (make lint-editorconfig-files) could not run in this sandboxed session: it attempts to download the editorconfig-checker binary from github.com/editorconfig-checker/editorconfig-checker, a repository outside this session's permitted GitHub access scope, and fails with a 403. This is an environment/tooling limitation unrelated to this diff's content. The commit was made with SKIP_LINT_EDITORCONFIG=1 (all other pre-commit checks, including ESLint and license headers, ran normally and passed); the diff was manually checked for indentation (tabs, no space-indentation) and trailing-whitespace/EOF-newline consistency with the surrounding unmodified code.

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 end-to-end by an automated Claude Code agent running as a scheduled task on behalf of the repository owner, following the conventions established in prior merged ULP-migration PRs for this issue (e.g. #13941, #13961).


@stdlib-js/reviewers


Generated by Claude Code

Replaces the computed EPS-tolerance idiom (delta/tol) in the fixture-loop
assertions with `@stdlib/assert/is-almost-same-value`, using the minimum
ULP bound that passes across the full fixture set for each test group.

Ref: #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 Math Issue or pull request specific to math functionality. Good First PR A pull request resolving a Good First Issue. labels Aug 6, 2026
@kgryte kgryte added the Tests Pull requests specifically adding tests. label Aug 6, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/cphase $\\color{green}138/138$
$\\color{green}+100.00\\%$
$\\color{green}5/5$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}138/138$
$\\color{green}+100.00\\%$

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

@kgryte
kgryte marked this pull request as ready for review August 6, 2026 09:21
@kgryte
kgryte requested a review from a team August 6, 2026 09:21
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 6, 2026
@kgryte
kgryte merged commit b5be51a into develop Aug 6, 2026
86 checks passed
@kgryte
kgryte deleted the philipp/ulp-cphase branch August 6, 2026 09:21
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 6, 2026
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