Skip to content

test: migrate math/base/tools/sum-series to ULP-based assertions - #16218

Draft
kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-sum-series
Draft

kgryte wants to merge 1 commit into
developfrom
kgryte/ulp-sum-series

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:

Files changed

  • test/test.js (4 assertions)
  • test/es2015-generator/index.js (1 assertion)

No non-test files are touched, and no implementation behavior changes.

ULP bounds

Each assertion uses the minimum required ULP value, measured against the values actually produced in this environment:

Test file Assertion Measured ULP difference ULP bound used
test/test.js sum of series from a closure 3 3
test/test.js sum of series from a closure (generators unsupported) 3 3
test/test.js sum of series with a specified initial value 0 (bit-exact) 0
test/test.js sum of series with a specified initial value (generators unsupported) 0 (bit-exact) 0
test/es2015-generator/index.js sum of series from a generator 3 3

The two assertions comparing against integer-valued results (maxTerms: 3, expected 6) were already exact t.strictEqual comparisons and are intentionally left unchanged.

Tightness was verified by lowering the bound: at 2 ULP, exactly the three 3-ULP assertions fail, so 3 is minimal. The 0-ULP assertions are bit-exact (isSameValue), so they cannot be tightened further. The suite was run twice at the final bounds with identical results (9/9 passing), so the measured differences are not FMA/arch-dependent flake in this environment.

make test TESTS_FILTER=".*/math/base/tools/sum-series/.*"
# total: 9, passing: 9

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?

Two points worth a reviewer's eye:

  1. Scope. test/es2015-generator/index.js is converted alongside test/test.js, since test.js requires it and it carried the same tolerance idiom. This mirrors the sibling migration for math/base/tools/continued-fraction (test: migrate math/base/tools/continued-fraction to ULP-based assertions #15573), which converted both files together. Happy to narrow the PR to test/test.js if you would prefer the generator test handled separately.
  2. Lint directive. The eslint-disable directive in test/es2015-generator/index.js is updated from no-restricted-syntax, no-plusplus, require-jsdoc to no-restricted-syntax, no-plusplus, n/no-unsupported-features/es-syntax. This is a pre-existing lint failure in that file, not one introduced here, but since the PR touches the file it would otherwise ship red. The same rule was added to the directive in the continued-fraction migration, whose generator test now lints clean. Let me know if you would rather this be split into its own change.

Other

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

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

This PR was authored by Claude Code running as an unattended scheduled task. The agent selected the package, studied the prior math/base/tools/continued-fraction migration to match the project's settled idiom, measured the per-assertion ULP differences, tightened each bound to its minimum, and verified tests and linting locally. Opened as a draft for human review.


@stdlib-js/reviewers


Generated by Claude Code

Replace the `abs( actual - expected ) < EPS` tolerance assertions with
`@stdlib/assert/is-almost-same-value`, using the minimum required ULP
values: 3 for the series sums and 0 (bit-exact) for the results computed
with a specified initial value.

Additionally, update the `eslint-disable` directive in the generator test
to silence `n/no-unsupported-features/es-syntax` and to drop the unused
`require-jsdoc` entry, mirroring the `math/base/tools/continued-fraction`
migration and keeping the file lint-clean.

Ref: #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018w6owRroGP96wR2GYsQN6T
@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 Oct 17, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/tools/sum-series $\\color{red}219/246$
$\\color{green}+89.02\\%$
$\\color{red}14/15$
$\\color{green}+93.33\\%$
$\\color{red}1/2$
$\\color{green}+50.00\\%$
$\\color{red}219/246$
$\\color{green}+89.02\\%$

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

Good First PR A pull request resolving a Good First Issue. Math Issue or pull request specific to math functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants