Skip to content

Commit f042055

Browse files
committed
Auto-generated commit
1 parent ab1a9eb commit f042055

4 files changed

Lines changed: 25 additions & 130 deletions

File tree

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ package.json.copy
2525
###############
2626
build/
2727
downloads/
28+
plans/
2829
reports/
2930
tmp/
3031

@@ -175,6 +176,10 @@ acs-*.bib
175176
*.ind
176177
*.ist
177178

179+
# Git #
180+
#######
181+
.worktrees
182+
178183
# Visual Studio #
179184
#################
180185
.vscode/

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2026-04-21)
7+
## Unreleased (2026-04-29)
88

99
<section class="commits">
1010

1111
### Commits
1212

1313
<details>
1414

15+
- [`4cd8e43`](https://github.com/stdlib-js/stdlib/commit/4cd8e438cc1b4e41e546704905ef9576d65bf0fc) - **test:** migrate `math/base/special/cbrt` to ULP-based testing [(#11839)](https://github.com/stdlib-js/stdlib/pull/11839) _(by Mandeep2333)_
1516
- [`c73c8b3`](https://github.com/stdlib-js/stdlib/commit/c73c8b39bd76529182ea2b3423c6f0feab434774) - **bench:** refactor to use string interpolation in `math/base/special` [(#11387)](https://github.com/stdlib-js/stdlib/pull/11387) _(by Karan Anand)_
1617

1718
</details>
@@ -24,9 +25,10 @@
2425

2526
### Contributors
2627

27-
A total of 1 person contributed to this release. Thank you to this contributor:
28+
A total of 2 people contributed to this release. Thank you to the following contributors:
2829

2930
- Karan Anand
31+
- Mandeep2333
3032

3133
</section>
3234

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"@stdlib/utils-library-manifest": "^0.2.4"
5555
},
5656
"devDependencies": {
57+
"@stdlib/assert-is-almost-same-value": "^0.1.1",
5758
"@stdlib/console-log-each-map": "^0.1.1",
5859
"@stdlib/constants-float64-eps": "^0.2.3",
5960
"@stdlib/constants-float64-ninf": "^0.2.3",

test/test.js

Lines changed: 15 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ var isNegativeZero = require( '@stdlib/math-base-assert-is-negative-zero' );
2626
var isPositiveZero = require( '@stdlib/math-base-assert-is-positive-zero' );
2727
var PINF = require( '@stdlib/constants-float64-pinf' );
2828
var NINF = require( '@stdlib/constants-float64-ninf' );
29-
var EPS = require( '@stdlib/constants-float64-eps' );
30-
var abs = require( '@stdlib/math-base-special-abs' );
29+
var isAlmostSameValue = require( '@stdlib/assert-is-almost-same-value' );
3130
var cbrt = require( './../lib' );
3231

3332

@@ -59,8 +58,6 @@ tape( 'main export is a function', function test( t ) {
5958

6059
tape( 'the function evaluates the cubic root of `x` on the interval `[-50,-500]', function test( t ) {
6160
var expected;
62-
var delta;
63-
var tol;
6461
var x;
6562
var y;
6663
var i;
@@ -69,21 +66,13 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-50,-500]'
6966
x = veryLargeNegative.x;
7067
for ( i = 0; i < x.length; i++ ) {
7168
y = cbrt( x[i] );
72-
if ( y === expected[i] ) {
73-
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
74-
} else {
75-
delta = abs( y - expected[ i ] );
76-
tol = EPS * abs( expected[ i ] );
77-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol );
78-
}
69+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
7970
}
8071
t.end();
8172
});
8273

8374
tape( 'the function evaluates the cubic root of `x` on the interval `[50,500]`', function test( t ) {
8475
var expected;
85-
var delta;
86-
var tol;
8776
var x;
8877
var y;
8978
var i;
@@ -92,21 +81,13 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[50,500]`',
9281
x = veryLargePositive.x;
9382
for ( i = 0; i < x.length; i++ ) {
9483
y = cbrt( x[i] );
95-
if ( y === expected[i] ) {
96-
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
97-
} else {
98-
delta = abs( y - expected[ i ] );
99-
tol = EPS * abs( expected[ i ] );
100-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol );
101-
}
84+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
10285
}
10386
t.end();
10487
});
10588

10689
tape( 'the function evaluates the cubic root of `x` on the interval `[-20,-50]`', function test( t ) {
10790
var expected;
108-
var delta;
109-
var tol;
11091
var x;
11192
var y;
11293
var i;
@@ -115,21 +96,13 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-20,-50]`'
11596
x = largeNegative.x;
11697
for ( i = 0; i < x.length; i++ ) {
11798
y = cbrt( x[i] );
118-
if ( y === expected[i] ) {
119-
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
120-
} else {
121-
delta = abs( y - expected[ i ] );
122-
tol = EPS * abs( expected[ i ] );
123-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol );
124-
}
99+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
125100
}
126101
t.end();
127102
});
128103

129104
tape( 'the function evaluates the cubic root of `x` on the interval `[20,50]`', function test( t ) {
130105
var expected;
131-
var delta;
132-
var tol;
133106
var x;
134107
var y;
135108
var i;
@@ -138,21 +111,13 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[20,50]`',
138111
x = largePositive.x;
139112
for ( i = 0; i < x.length; i++ ) {
140113
y = cbrt( x[i] );
141-
if ( y === expected[i] ) {
142-
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
143-
} else {
144-
delta = abs( y - expected[ i ] );
145-
tol = EPS * abs( expected[ i ] );
146-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol );
147-
}
114+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
148115
}
149116
t.end();
150117
});
151118

152119
tape( 'the function evaluates the cubic root of `x` on the interval `[-20,-3]`', function test( t ) {
153120
var expected;
154-
var delta;
155-
var tol;
156121
var x;
157122
var y;
158123
var i;
@@ -161,21 +126,13 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-20,-3]`',
161126
x = mediumNegative.x;
162127
for ( i = 0; i < x.length; i++ ) {
163128
y = cbrt( x[i] );
164-
if ( y === expected[i] ) {
165-
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
166-
} else {
167-
delta = abs( y - expected[ i ] );
168-
tol = EPS * abs( expected[ i ] );
169-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol );
170-
}
129+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
171130
}
172131
t.end();
173132
});
174133

175134
tape( 'the function evaluates the cubic root of `x` on the interval `[3,20]`', function test( t ) {
176135
var expected;
177-
var delta;
178-
var tol;
179136
var x;
180137
var y;
181138
var i;
@@ -184,21 +141,13 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[3,20]`', f
184141
x = mediumPositive.x;
185142
for ( i = 0; i < x.length; i++ ) {
186143
y = cbrt( x[i] );
187-
if ( y === expected[i] ) {
188-
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
189-
} else {
190-
delta = abs( y - expected[ i ] );
191-
tol = EPS * abs( expected[ i ] );
192-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol );
193-
}
144+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
194145
}
195146
t.end();
196147
});
197148

198149
tape( 'the function evaluates the cubic root of `x` on the interval `[-3,-0.8]`', function test( t ) {
199150
var expected;
200-
var delta;
201-
var tol;
202151
var x;
203152
var y;
204153
var i;
@@ -207,21 +156,13 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-3,-0.8]`'
207156
x = smallNegative.x;
208157
for ( i = 0; i < x.length; i++ ) {
209158
y = cbrt( x[i] );
210-
if ( y === expected[i] ) {
211-
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
212-
} else {
213-
delta = abs( y - expected[ i ] );
214-
tol = EPS * abs( expected[ i ] );
215-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol );
216-
}
159+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
217160
}
218161
t.end();
219162
});
220163

221164
tape( 'the function evaluates the cubic root of `x` on the interval `[0.8,3]`', function test( t ) {
222165
var expected;
223-
var delta;
224-
var tol;
225166
var x;
226167
var y;
227168
var i;
@@ -230,21 +171,13 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[0.8,3]`',
230171
x = smallPositive.x;
231172
for ( i = 0; i < x.length; i++ ) {
232173
y = cbrt( x[i] );
233-
if ( y === expected[i] ) {
234-
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
235-
} else {
236-
delta = abs( y - expected[ i ] );
237-
tol = EPS * abs( expected[ i ] );
238-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol );
239-
}
174+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
240175
}
241176
t.end();
242177
});
243178

244179
tape( 'the function evaluates cubic root of `x` on the interval `[-0.8,0.8]`', function test( t ) {
245180
var expected;
246-
var delta;
247-
var tol;
248181
var x;
249182
var y;
250183
var i;
@@ -253,21 +186,13 @@ tape( 'the function evaluates cubic root of `x` on the interval `[-0.8,0.8]`', f
253186
x = smaller.x;
254187
for ( i = 0; i < x.length; i++ ) {
255188
y = cbrt( x[i] );
256-
if ( y === expected[i] ) {
257-
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
258-
} else {
259-
delta = abs( y - expected[ i ] );
260-
tol = EPS * abs( expected[ i ] );
261-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol );
262-
}
189+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
263190
}
264191
t.end();
265192
});
266193

267194
tape( 'the function evaluates the cubic root of `x` on the interval `[-1e-300,-1e-308]`', function test( t ) {
268195
var expected;
269-
var delta;
270-
var tol;
271196
var x;
272197
var y;
273198
var i;
@@ -276,21 +201,13 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[-1e-300,-1
276201
x = tinyNegative.x;
277202
for ( i = 0; i < x.length; i++ ) {
278203
y = cbrt( x[i] );
279-
if ( y === expected[i] ) {
280-
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
281-
} else {
282-
delta = abs( y - expected[ i ] );
283-
tol = EPS * abs( expected[ i ] );
284-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol );
285-
}
204+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
286205
}
287206
t.end();
288207
});
289208

290209
tape( 'the function evaluates the cubic root of `x` on the interval `[1e-300,1e-308]`', function test( t ) {
291210
var expected;
292-
var delta;
293-
var tol;
294211
var x;
295212
var y;
296213
var i;
@@ -299,21 +216,13 @@ tape( 'the function evaluates the cubic root of `x` on the interval `[1e-300,1e-
299216
x = tinyPositive.x;
300217
for ( i = 0; i < x.length; i++ ) {
301218
y = cbrt( x[i] );
302-
if ( y === expected[i] ) {
303-
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
304-
} else {
305-
delta = abs( y - expected[ i ] );
306-
tol = EPS * abs( expected[ i ] );
307-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol );
308-
}
219+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
309220
}
310221
t.end();
311222
});
312223

313224
tape( 'the function evaluates the cubic root of subnormal `x`', function test( t ) {
314225
var expected;
315-
var delta;
316-
var tol;
317226
var x;
318227
var y;
319228
var i;
@@ -322,21 +231,13 @@ tape( 'the function evaluates the cubic root of subnormal `x`', function test( t
322231
x = subnormal.x;
323232
for ( i = 0; i < x.length; i++ ) {
324233
y = cbrt( x[i] );
325-
if ( y === expected[i] ) {
326-
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
327-
} else {
328-
delta = abs( y - expected[ i ] );
329-
tol = EPS * abs( expected[ i ] );
330-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol );
331-
}
234+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
332235
}
333236
t.end();
334237
});
335238

336239
tape( 'the function evaluates the cubic root of `x` (huge negative)', function test( t ) {
337240
var expected;
338-
var delta;
339-
var tol;
340241
var x;
341242
var y;
342243
var i;
@@ -346,21 +247,13 @@ tape( 'the function evaluates the cubic root of `x` (huge negative)', function t
346247

347248
for ( i = 0; i < x.length; i++ ) {
348249
y = cbrt( x[i] );
349-
if ( y === expected[i] ) {
350-
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
351-
} else {
352-
delta = abs( y - expected[ i ] );
353-
tol = EPS * abs( expected[ i ] );
354-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol );
355-
}
250+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
356251
}
357252
t.end();
358253
});
359254

360255
tape( 'the function evaluates the cubic root of `x` (huge positive)', function test( t ) {
361256
var expected;
362-
var delta;
363-
var tol;
364257
var x;
365258
var y;
366259
var i;
@@ -370,13 +263,7 @@ tape( 'the function evaluates the cubic root of `x` (huge positive)', function t
370263

371264
for ( i = 0; i < x.length; i++ ) {
372265
y = cbrt( x[i] );
373-
if ( y === expected[i] ) {
374-
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
375-
} else {
376-
delta = abs( y - expected[ i ] );
377-
tol = EPS * abs( expected[ i ] );
378-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol );
379-
}
266+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
380267
}
381268
t.end();
382269
});

0 commit comments

Comments
 (0)