From c7d67c227ada825ef6e7f871ce55389b018b623e Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 17 Oct 2026 22:12:17 +0000 Subject: [PATCH] test: migrate `math/base/tools/sum-series` to ULP-based assertions 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: https://github.com/stdlib-js/stdlib/issues/11352 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_018w6owRroGP96wR2GYsQN6T --- .../tools/sum-series/test/es2015-generator/index.js | 7 +++---- .../@stdlib/math/base/tools/sum-series/test/test.js | 11 +++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/tools/sum-series/test/es2015-generator/index.js b/lib/node_modules/@stdlib/math/base/tools/sum-series/test/es2015-generator/index.js index ddf874128f0d..8e6e6f2f3c21 100644 --- a/lib/node_modules/@stdlib/math/base/tools/sum-series/test/es2015-generator/index.js +++ b/lib/node_modules/@stdlib/math/base/tools/sum-series/test/es2015-generator/index.js @@ -21,9 +21,8 @@ // MODULES // var tape = require( 'tape' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var log1p = require( '@stdlib/math/base/special/log1p' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var sumSeries = require( './../../lib' ); @@ -33,10 +32,10 @@ tape( 'the function calculates the sum of an infinite series provided by a gener var expected = log1p( 0.5 ); var actual = sumSeries( generator( 0.5 ) ); - t.ok( abs( actual - expected ) < EPS, 'returned result is within tolerance. actual: ' + actual + '; expected: ' + expected + '.' ); + t.strictEqual( isAlmostSameValue( actual, expected, 3 ), true, 'returns expected value' ); t.end(); - /* eslint-disable no-restricted-syntax, no-plusplus, require-jsdoc */ + /* eslint-disable no-restricted-syntax, no-plusplus, n/no-unsupported-features/es-syntax */ function* generator( x ) { var mMult = -x; var mProd = -1; diff --git a/lib/node_modules/@stdlib/math/base/tools/sum-series/test/test.js b/lib/node_modules/@stdlib/math/base/tools/sum-series/test/test.js index 18032d420625..70a672175a20 100644 --- a/lib/node_modules/@stdlib/math/base/tools/sum-series/test/test.js +++ b/lib/node_modules/@stdlib/math/base/tools/sum-series/test/test.js @@ -23,9 +23,8 @@ var tape = require( 'tape' ); var proxyquire = require( 'proxyquire' ); var detectGeneratorSupport = require( '@stdlib/assert/has-generator-support' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var log1p = require( '@stdlib/math/base/special/log1p' ); -var abs = require( '@stdlib/math/base/special/abs' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var sumSeries = require( './../lib' ); var sumSeriesBasic = proxyquire( './../lib', { 'detect-generator-support': function getFalse() { return false; } @@ -55,7 +54,7 @@ tape( 'the function calculates the sum of an infinite series provided by a closu var expected = log1p( 0.5 ); var actual = sumSeries( closure( 0.5 ) ); - t.ok( abs( actual - expected ) < EPS, 'returned result is within tolerance. actual: ' + actual + '; expected: ' + expected + '.' ); + t.strictEqual( isAlmostSameValue( actual, expected, 3 ), true, 'returns expected value' ); t.end(); function closure( x ) { @@ -75,7 +74,7 @@ tape( 'the function calculates the sum of an infinite series provided by a closu var expected = log1p( 0.5 ); var actual = sumSeriesBasic( closure( 0.5 ) ); - t.ok( abs( actual - expected ) < EPS, 'returned result is within tolerance. actual: ' + actual + '; expected: ' + expected + '.' ); + t.strictEqual( isAlmostSameValue( actual, expected, 3 ), true, 'returns expected value' ); t.end(); function closure( x ) { @@ -96,7 +95,7 @@ tape( 'the function calculates the sum of an infinite series with a specified in 'initialValue': 2 }); - t.ok( abs( actual - expected ) < EPS, 'returned result is within tolerance. actual: ' + actual + '; expected: ' + expected + '.' ); + t.strictEqual( isAlmostSameValue( actual, expected, 0 ), true, 'returns expected value' ); t.end(); function closure( x ) { @@ -118,7 +117,7 @@ tape( 'the function calculates the sum of an infinite series with a specified in 'initialValue': 2 }); - t.ok( abs( actual - expected ) < EPS, 'returned result is within tolerance. actual: ' + actual + '; expected: ' + expected + '.' ); + t.strictEqual( isAlmostSameValue( actual, expected, 0 ), true, 'returns expected value' ); t.end(); function closure( x ) {