Skip to content

Commit 7e2a366

Browse files
committed
Auto-generated commit
1 parent b110d60 commit 7e2a366

7 files changed

Lines changed: 29 additions & 122 deletions

File tree

.github/.keepalive

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.md

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

7-
## Unreleased (2026-06-10)
7+
## Unreleased (2026-06-16)
88

99
<section class="commits">
1010

1111
### Commits
1212

1313
<details>
1414

15+
- [`22ab27f`](https://github.com/stdlib-js/stdlib/commit/22ab27f23e10197529bd1f7c785bcd4c33f63a25) - **test:** migrate `math/base/special/erfcx` to ULP-based testing [(#12775)](https://github.com/stdlib-js/stdlib/pull/12775) _(by Philipp Burckhardt)_
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
- [`8448f5a`](https://github.com/stdlib-js/stdlib/commit/8448f5a44bad7e305d50ac9e92ba195bac863389) - **chore:** ensure consistent use of semicolons [(#11170)](https://github.com/stdlib-js/stdlib/pull/11170) _(by Philipp Burckhardt, Athan Reines)_
1718

dist/index.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@
4848
"@stdlib/utils-library-manifest": "^0.2.4"
4949
},
5050
"devDependencies": {
51+
"@stdlib/assert-is-almost-same-value": "^0.1.1",
5152
"@stdlib/console-log-each-map": "^0.1.1",
52-
"@stdlib/constants-float64-eps": "^0.2.3",
53-
"@stdlib/math-base-special-abs": "^0.2.3",
5453
"@stdlib/random-array-uniform": "^0.2.2",
5554
"@stdlib/string-format": "^0.2.3",
5655
"@stdlib/utils-try-require": "^0.2.3",

test/test.js

Lines changed: 7 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222

2323
var tape = require( 'tape' );
2424
var isnan = require( '@stdlib/math-base-assert-is-nan' );
25-
var abs = require( '@stdlib/math-base-special-abs' );
2625
var PINF = require( '@stdlib/constants-float64-pinf' );
27-
var EPS = require( '@stdlib/constants-float64-eps' );
26+
var isAlmostSameValue = require( '@stdlib/assert-is-almost-same-value' );
2827
var erfcx = require( './../lib' );
2928

3029

@@ -96,8 +95,6 @@ tape( 'the function returns `( 1 / sqrt(pi) ) / x` if `x` is larger than `5e7`',
9695

9796
tape( 'the function computes the scaled complementary error function for positive medium numbers', function test( t ) {
9897
var expected;
99-
var delta;
100-
var tol;
10198
var x;
10299
var y;
103100
var i;
@@ -106,21 +103,13 @@ tape( 'the function computes the scaled complementary error function for positiv
106103
x = mediumPositive.x;
107104
for ( i = 0; i < expected.length; i++ ) {
108105
y = erfcx( x[ i ] );
109-
if ( y === expected[ i ] ) {
110-
t.strictEqual( y, expected[ i ], 'returns '+y+' when provided '+x[i]+'.' );
111-
} else {
112-
delta = abs( expected[ i ] - y );
113-
tol = EPS * abs( expected[ i ] );
114-
t.ok( delta <= tol, 'within tolerance. returns '+y+' when provided '+x[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: ' +tol+'.' );
115-
}
106+
t.strictEqual( y, expected[ i ], 'returns expected value' );
116107
}
117108
t.end();
118109
});
119110

120111
tape( 'the function computes the scaled complementary error function for positive small numbers', function test( t ) {
121112
var expected;
122-
var delta;
123-
var tol;
124113
var x;
125114
var y;
126115
var i;
@@ -129,21 +118,13 @@ tape( 'the function computes the scaled complementary error function for positiv
129118
x = smallPositive.x;
130119
for ( i = 0; i < expected.length; i++ ) {
131120
y = erfcx( x[ i ] );
132-
if ( y === expected[ i ] ) {
133-
t.strictEqual( y, expected[ i ], 'returns '+y+' when provided '+x[i]+'.' );
134-
} else {
135-
delta = abs( expected[ i ] - y );
136-
tol = EPS * abs( expected[ i ] );
137-
t.ok( delta <= tol, 'within tolerance. returns '+y+' when provided '+x[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: ' +tol+'.' );
138-
}
121+
t.strictEqual( y, expected[ i ], 'returns expected value' );
139122
}
140123
t.end();
141124
});
142125

143126
tape( 'the function computes the scaled complementary error function for negative small numbers', function test( t ) {
144127
var expected;
145-
var delta;
146-
var tol;
147128
var x;
148129
var y;
149130
var i;
@@ -152,21 +133,13 @@ tape( 'the function computes the scaled complementary error function for negativ
152133
x = smallNegative.x;
153134
for ( i = 0; i < expected.length; i++ ) {
154135
y = erfcx( x[ i ] );
155-
if ( y === expected[ i ] ) {
156-
t.strictEqual( y, expected[ i ], 'returns '+y+' when provided '+x[i]+'.' );
157-
} else {
158-
delta = abs( expected[ i ] - y );
159-
tol = 2.0 * EPS * abs( expected[ i ] );
160-
t.ok( delta <= tol, 'within tolerance. returns '+y+' when provided '+x[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: ' +tol+'.' );
161-
}
136+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 2 ), true, 'returns expected value' );
162137
}
163138
t.end();
164139
});
165140

166141
tape( 'the function computes the scaled complementary error function for negative medium numbers', function test( t ) {
167142
var expected;
168-
var delta;
169-
var tol;
170143
var x;
171144
var y;
172145
var i;
@@ -175,21 +148,13 @@ tape( 'the function computes the scaled complementary error function for negativ
175148
x = mediumNegative.x;
176149
for ( i = 0; i < expected.length; i++ ) {
177150
y = erfcx( x[ i ] );
178-
if ( y === expected[ i ] ) {
179-
t.strictEqual( y, expected[ i ], 'returns '+y+' when provided '+x[i]+'.' );
180-
} else {
181-
delta = abs( expected[ i ] - y );
182-
tol = EPS * abs( expected[ i ] );
183-
t.ok( delta <= tol, 'within tolerance. returns '+y+' when provided '+x[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: ' +tol+'.' );
184-
}
151+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
185152
}
186153
t.end();
187154
});
188155

189156
tape( 'the function computes the scaled complementary error function for positive large numbers', function test( t ) {
190157
var expected;
191-
var delta;
192-
var tol;
193158
var x;
194159
var y;
195160
var i;
@@ -198,21 +163,13 @@ tape( 'the function computes the scaled complementary error function for positiv
198163
x = largePositive.x;
199164
for ( i = 0; i < expected.length; i++ ) {
200165
y = erfcx( x[ i ] );
201-
if ( y === expected[ i ] ) {
202-
t.strictEqual( y, expected[ i ], 'returns '+y+' when provided '+x[i]+'.' );
203-
} else {
204-
delta = abs( expected[ i ] - y );
205-
tol = EPS * abs( expected[ i ] );
206-
t.ok( delta <= tol, 'within tolerance. returns '+y+' when provided '+x[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: ' +tol+'.' );
207-
}
166+
t.strictEqual( y, expected[ i ], 'returns expected value' );
208167
}
209168
t.end();
210169
});
211170

212171
tape( 'the function computes the scaled complementary error function for tiny numbers', function test( t ) {
213172
var expected;
214-
var delta;
215-
var tol;
216173
var x;
217174
var y;
218175
var i;
@@ -221,13 +178,7 @@ tape( 'the function computes the scaled complementary error function for tiny nu
221178
x = tiny.x;
222179
for ( i = 0; i < expected.length; i++ ) {
223180
y = erfcx( x[ i ] );
224-
if ( y === expected[ i ] ) {
225-
t.strictEqual( y, expected[ i ], 'returns '+y+' when provided '+x[i]+'.' );
226-
} else {
227-
delta = abs( expected[ i ] - y );
228-
tol = EPS * abs( expected[ i ] );
229-
t.ok( delta <= tol, 'within tolerance. returns '+y+' when provided '+x[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: ' +tol+'.' );
230-
}
181+
t.strictEqual( y, expected[ i ], 'returns expected value' );
231182
}
232183
t.end();
233184
});

test/test.native.js

Lines changed: 13 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@
2323
var resolve = require( 'path' ).resolve;
2424
var tape = require( 'tape' );
2525
var isnan = require( '@stdlib/math-base-assert-is-nan' );
26-
var abs = require( '@stdlib/math-base-special-abs' );
2726
var PINF = require( '@stdlib/constants-float64-pinf' );
28-
var EPS = require( '@stdlib/constants-float64-eps' );
27+
var isAlmostSameValue = require( '@stdlib/assert-is-almost-same-value' );
2928
var tryRequire = require( '@stdlib/utils-try-require' );
3029

3130

@@ -101,8 +100,6 @@ tape( 'the function returns `( 1 / sqrt(pi) ) / x` if `x` is larger than `5e7`',
101100

102101
tape( 'the function computes the scaled complementary error function for positive medium numbers', opts, function test( t ) {
103102
var expected;
104-
var delta;
105-
var tol;
106103
var x;
107104
var y;
108105
var i;
@@ -111,21 +108,15 @@ tape( 'the function computes the scaled complementary error function for positiv
111108
x = mediumPositive.x;
112109
for ( i = 0; i < expected.length; i++ ) {
113110
y = erfcx( x[ i ] );
114-
if ( y === expected[ i ] ) {
115-
t.strictEqual( y, expected[ i ], 'returns '+y+' when provided '+x[i]+'.' );
116-
} else {
117-
delta = abs( expected[ i ] - y );
118-
tol = EPS * abs( expected[ i ] );
119-
t.ok( delta <= tol, 'within tolerance. returns '+y+' when provided '+x[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: ' +tol+'.' );
120-
}
111+
112+
// NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205
113+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
121114
}
122115
t.end();
123116
});
124117

125118
tape( 'the function computes the scaled complementary error function for positive small numbers', opts, function test( t ) {
126119
var expected;
127-
var delta;
128-
var tol;
129120
var x;
130121
var y;
131122
var i;
@@ -134,21 +125,15 @@ tape( 'the function computes the scaled complementary error function for positiv
134125
x = smallPositive.x;
135126
for ( i = 0; i < expected.length; i++ ) {
136127
y = erfcx( x[ i ] );
137-
if ( y === expected[ i ] ) {
138-
t.strictEqual( y, expected[ i ], 'returns '+y+' when provided '+x[i]+'.' );
139-
} else {
140-
delta = abs( expected[ i ] - y );
141-
tol = EPS * abs( expected[ i ] );
142-
t.ok( delta <= tol, 'within tolerance. returns '+y+' when provided '+x[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: ' +tol+'.' );
143-
}
128+
129+
// NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205
130+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
144131
}
145132
t.end();
146133
});
147134

148135
tape( 'the function computes the scaled complementary error function for negative small numbers', opts, function test( t ) {
149136
var expected;
150-
var delta;
151-
var tol;
152137
var x;
153138
var y;
154139
var i;
@@ -157,21 +142,13 @@ tape( 'the function computes the scaled complementary error function for negativ
157142
x = smallNegative.x;
158143
for ( i = 0; i < expected.length; i++ ) {
159144
y = erfcx( x[ i ] );
160-
if ( y === expected[ i ] ) {
161-
t.strictEqual( y, expected[ i ], 'returns '+y+' when provided '+x[i]+'.' );
162-
} else {
163-
delta = abs( expected[ i ] - y );
164-
tol = 2.0 * EPS * abs( expected[ i ] );
165-
t.ok( delta <= tol, 'within tolerance. returns '+y+' when provided '+x[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: ' +tol+'.' );
166-
}
145+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 2 ), true, 'returns expected value' );
167146
}
168147
t.end();
169148
});
170149

171150
tape( 'the function computes the scaled complementary error function for negative medium numbers', opts, function test( t ) {
172151
var expected;
173-
var delta;
174-
var tol;
175152
var x;
176153
var y;
177154
var i;
@@ -180,21 +157,13 @@ tape( 'the function computes the scaled complementary error function for negativ
180157
x = mediumNegative.x;
181158
for ( i = 0; i < expected.length; i++ ) {
182159
y = erfcx( x[ i ] );
183-
if ( y === expected[ i ] ) {
184-
t.strictEqual( y, expected[ i ], 'returns '+y+' when provided '+x[i]+'.' );
185-
} else {
186-
delta = abs( expected[ i ] - y );
187-
tol = EPS * abs( expected[ i ] );
188-
t.ok( delta <= tol, 'within tolerance. returns '+y+' when provided '+x[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: ' +tol+'.' );
189-
}
160+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
190161
}
191162
t.end();
192163
});
193164

194165
tape( 'the function computes the scaled complementary error function for positive large numbers', opts, function test( t ) {
195166
var expected;
196-
var delta;
197-
var tol;
198167
var x;
199168
var y;
200169
var i;
@@ -203,21 +172,15 @@ tape( 'the function computes the scaled complementary error function for positiv
203172
x = largePositive.x;
204173
for ( i = 0; i < expected.length; i++ ) {
205174
y = erfcx( x[ i ] );
206-
if ( y === expected[ i ] ) {
207-
t.strictEqual( y, expected[ i ], 'returns '+y+' when provided '+x[i]+'.' );
208-
} else {
209-
delta = abs( expected[ i ] - y );
210-
tol = EPS * abs( expected[ i ] );
211-
t.ok( delta <= tol, 'within tolerance. returns '+y+' when provided '+x[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: ' +tol+'.' );
212-
}
175+
176+
// NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205
177+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
213178
}
214179
t.end();
215180
});
216181

217182
tape( 'the function computes the scaled complementary error function for tiny numbers', opts, function test( t ) {
218183
var expected;
219-
var delta;
220-
var tol;
221184
var x;
222185
var y;
223186
var i;
@@ -226,13 +189,7 @@ tape( 'the function computes the scaled complementary error function for tiny nu
226189
x = tiny.x;
227190
for ( i = 0; i < expected.length; i++ ) {
228191
y = erfcx( x[ i ] );
229-
if ( y === expected[ i ] ) {
230-
t.strictEqual( y, expected[ i ], 'returns '+y+' when provided '+x[i]+'.' );
231-
} else {
232-
delta = abs( expected[ i ] - y );
233-
tol = EPS * abs( expected[ i ] );
234-
t.ok( delta <= tol, 'within tolerance. returns '+y+' when provided '+x[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: ' +tol+'.' );
235-
}
192+
t.strictEqual( y, expected[ i ], 'returns expected value' );
236193
}
237194
t.end();
238195
});

0 commit comments

Comments
 (0)