Skip to content

Commit 5ceb866

Browse files
chores
1 parent fd5cf0f commit 5ceb866

File tree

3 files changed

+19
-22
lines changed

3 files changed

+19
-22
lines changed

lib/node_modules/@stdlib/stats/base/ndarray/dmidrange/benchmark/benchmark.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
var bench = require( '@stdlib/bench' );
2424
var uniform = require( '@stdlib/random/base/uniform' );
25-
var bernoulli = require( '@stdlib/random/base/bernoulli' );
2625
var filledarrayBy = require( '@stdlib/array/filled-by' );
2726
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2827
var pow = require( '@stdlib/math/base/special/pow' );
@@ -40,9 +39,6 @@ var dmidrange = require( './../lib' );
4039
* @returns {number} random number or `NaN`
4140
*/
4241
function rand() {
43-
if ( bernoulli( 0.8 ) === 1 ) {
44-
return NaN;
45-
}
4642
return uniform( -10.0, 10.0 );
4743
}
4844

lib/node_modules/@stdlib/stats/base/ndarray/dmidrange/lib/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
'use strict';
2020

2121
/**
22-
* Compute the midrange of a one-dimensional double-precision floating-point ndarray, ignoring NaN values.
22+
* Compute the midrange of a one-dimensional double-precision floating-point ndarray If a `NaN` value is encountered during iteration, the.
23+
* function returns `NaN`.
2324
*
2425
* @module @stdlib/stats/base/ndarray/dmidrange
2526
*

lib/node_modules/@stdlib/stats/base/ndarray/dmidrange/test/test.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,22 @@ tape( 'the function has an arity of 1', function test( t ) {
5757
t.end();
5858
});
5959

60-
tape( 'the function computes the dmidrange value (ignoring NaNs)', function test( t ) {
60+
tape( 'the function returns NaN when encountering NaN values', function test( t ) {
6161
var x;
6262
var v;
6363

6464
x = new Float64Array( [ 1.0, -2.0, NaN, 2.0 ] );
6565

6666
v = dmidrange( [ vector( x, 4, 1, 0 ) ] );
67-
t.strictEqual( v, 0.0, 'returns expected value' );
67+
t.strictEqual( isnan( v ), true, 'returns NaN due to first NaN in scan order' );
6868

6969
x = new Float64Array( [ 1.0, -2.0, -4.0, 5.0, NaN, 0.0, 3.0 ] );
7070
v = dmidrange( [ vector( x, 7, 1, 0 ) ] );
71-
t.strictEqual( v, 0.5, 'returns expected value' );
71+
t.strictEqual( isnan( v ), true, 'returns NaN due to first NaN in scan order' );
7272

7373
x = new Float64Array( [ -4.0, NaN ] );
7474
v = dmidrange( [ vector( x, 2, 1, 0 ) ] );
75-
t.strictEqual( v, -4.0, 'returns expected value' );
75+
t.strictEqual( isnan( v ), true, 'returns NaN due to first NaN in scan order' );
7676
t.end();
7777
});
7878

@@ -112,19 +112,19 @@ tape( 'the function supports positive strides', function test( t ) {
112112
var v;
113113

114114
x = new Float64Array([
115-
1.0, // 0
115+
1.0,
116+
2.0,
116117
2.0,
117-
2.0, // 1
118118
-7.0,
119-
-2.0, // 2
119+
-2.0,
120120
3.0,
121-
4.0, // 3
121+
4.0,
122122
2.0,
123-
NaN // 4
123+
NaN
124124
]);
125125

126126
v = dmidrange( [ vector( x, 5, 2, 0 ) ] );
127-
t.strictEqual( v, 1.0, 'returns expected value' );
127+
t.strictEqual( isnan( v ), true, 'returns NaN due to NaN in scanned path' );
128128
t.end();
129129
});
130130

@@ -133,19 +133,19 @@ tape( 'the function supports negative strides', function test( t ) {
133133
var v;
134134

135135
x = new Float64Array([
136-
1.0, // 4
136+
1.0,
137+
2.0,
137138
2.0,
138-
2.0, // 3
139139
-7.0,
140-
-2.0, // 2
140+
-2.0,
141141
3.0,
142-
4.0, // 1
142+
4.0,
143143
2.0,
144-
NaN // 0
144+
NaN
145145
]);
146146

147147
v = dmidrange( [ vector( x, 5, -2, 8 ) ] );
148-
t.strictEqual( v, 1.0, 'returns expected value' );
148+
t.strictEqual( isnan( v ), true, 'returns NaN due to NaN in scanned path' );
149149
t.end();
150150
});
151151

@@ -178,7 +178,7 @@ tape( 'the function supports view offsets', function test( t ) {
178178
]);
179179

180180
v = dmidrange( [ vector( x, 5, 2, 1 ) ] );
181-
t.strictEqual( v, 1.0, 'returns expected value' );
181+
t.strictEqual( isnan( v ), true, 'returns NaN due to NaN in scanned path' );
182182

183183
t.end();
184184
});

0 commit comments

Comments
 (0)