test: migrate math/base/special/sincosd to ULP-based assertions - #13992
Open
kgryte wants to merge 1 commit into
Open
test: migrate math/base/special/sincosd to ULP-based assertions#13992kgryte wants to merge 1 commit into
math/base/special/sincosd to ULP-based assertions#13992kgryte wants to merge 1 commit into
Conversation
Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HMycrGkFdDy3nbXTV8wzFD
kgryte
marked this pull request as ready for review
August 6, 2026 23:18
Planeshifter
approved these changes
Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves a part of #11352.
Description
This pull request:
math/base/special/sincosdfrom relative tolerance (EPS-scaled) assertions to ULP-based assertions using@stdlib/assert/is-almost-same-value, matching the idiom used by previously converted double-precision packages (e.g.,expit,ellipk,factorialln,falling-factorial).test/test.main.js,test/test.assign.js, andtest/test.native.js, removing theEPS/absimports and thedelta/tolcomputations in favor oft.strictEqual( isAlmostSameValue( y[ 0 ], sine[ i ], N ), true, 'returns expected value' );.Final ULP constants:
sinecosinemedium_negative12medium_positive12large_negative11large_positive11huge_negative11huge_positive11The same constants are used in all three test files.
The bounds were tightened empirically rather than guessed. Starting from a high bound and lowering it, the measured maximum ULP distance over the full fixture set (6 fixture files × 4000 points = 24000 points, each contributing a
sineand acosineassertion) is:1ULP forsineacross every fixture set.2ULP forcosineon the twomediumfixture sets, and1ULP elsewhere.These are minimal:
sinefrom1to0produces 8260 failing assertions intest/test.main.js.mediumcosinebound from2to1produces 2 failing assertions.large/hugecosinebound from1to0produces 3472 failing assertions.At the final bounds,
test/test.main.jspasses all 48008 assertions andtest/test.assign.jspasses all 84024 assertions.Note that the previous relative tolerances already encoded this same split: the
mediumfixture sets usedtol = 1.01 * EPS * abs( cosine[i] )for the cosine while every other assertion usedtol = EPS * abs( ... ). The measured ULP bounds reproduce that structure exactly.Related Issues
This pull request has the following related issues:
math/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352Questions
Yes — one:
node-gypwas unavailable), sotest/test.native.jswas skipped rather than executed, and its ULP constants mirror the measured JavaScript bounds rather than being independently measured against the C implementation. Please confirm the native tests pass at these bounds in CI. If the C implementation is fractionally less accurate at any point, the corresponding constant intest/test.native.jsmay need to be raised.Other
test/test.jscontains no tolerance-based assertions (it only checks the exports), so it is unchanged.etc/eslint/.eslintrc.tests.js) is clean on all four test files.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code as part of an automated, unattended run: it selected the package, studied the idiom used in previously merged conversions, applied the test edits, and measured the minimum passing ULP bounds by running the suite.
@stdlib-js/reviewers
Generated by Claude Code