Skip to content

test: migrate math/base/special/cexp to ULP-based assertions - #14165

Open
Planeshifter wants to merge 1 commit into
developfrom
philipp/ulp-cexp
Open

test: migrate math/base/special/cexp to ULP-based assertions#14165
Planeshifter wants to merge 1 commit into
developfrom
philipp/ulp-cexp

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 math/base/special/cexp test cases from relative-tolerance (EPS-scaled delta/tol) comparisons to ULP-based assertions using @stdlib/assert/is-almost-same-value, per the RFC in [RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue) #11352.
  • Updates both test/test.js and test/test.native.js.
  • Measured the minimum ULP threshold that still passes over the full fixture set (pure_imaginary.json, general_complex.json), confirmed deterministic across two consecutive local runs:
    • test.js (pure JS implementation): 0 ULP for both the real and imaginary components (exact match against the reference fixtures).
    • test.native.js (native addon): 1 ULP for the real component (both fixture sets) and the imaginary component of the pure-imaginary fixture set; 2 ULP for the imaginary component of the general-complex fixture set, mirroring the pre-existing native implementation's wider tolerance (2.0 * EPS) for that specific case.

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.

  • Only the two test files for math/base/special/cexp were changed; no other packages were touched.
  • Verified: make test TESTS_FILTER=".*/math/base/special/cexp/.*" passes (2034/2034 for both test.js and the native addon build of test.native.js), and npx eslint is clean on both files.
  • Opened as a draft so a maintainer/the repo owner can review before marking ready, given this RFC issue asks contributors to author these migrations manually; see the AI Assistance disclosure below.

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 entirely by Claude Code (an automated, scheduled session), including discovering the candidate package, studying prior-art conversions (e.g. math/base/special/cinv), rewriting the test assertions, and empirically determining the ULP thresholds above. It is left as a draft specifically so a human can review it before it is considered for merge, given issue #11352 encourages contributors to author these migrations manually.


@stdlib-js/reviewers


Generated by Claude Code

Replace relative-tolerance (EPS-scaled delta/tol) comparisons with
`@stdlib/assert/is-almost-same-value` ULP-based assertions in both
test.js and test.native.js.

Measured minimum ULP thresholds (fixture set: pure_imaginary.json,
general_complex.json):
- test.js: 0 ULP for both real and imaginary components (exact match
  on the reference fixtures).
- test.native.js: 1 ULP for the real component and the pure-imaginary
  imaginary component; 2 ULP for the general-complex imaginary
  component, mirroring the native implementation's pre-existing wider
  tolerance for that case.

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 11, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/cexp $\\color{green}199/199$
$\\color{green}+100.00\\%$
$\\color{green}16/16$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}199/199$
$\\color{green}+100.00\\%$

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

@Planeshifter
Planeshifter marked this pull request as ready for review August 11, 2026 13:48
@Planeshifter
Planeshifter requested review from a team and kgryte August 11, 2026 13:48
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 11, 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. Needs Review A pull request which needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants