Skip to content

Commit 9a375e1

Browse files
committed
fixed issue #5902
1 parent badd101 commit 9a375e1

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

lib/node_modules/@stdlib/stats/base/dists/levy/median/benchmark/benchmark.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench' );
24-
var randu = require( '@stdlib/random/base/randu' );
24+
var uniform = require( '@stdlib/random/base/randu' );
2525
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2626
var EPS = require( '@stdlib/constants/float64/eps' );
2727
var pkg = require( './../package.json' ).name;
@@ -31,16 +31,24 @@ var median = require( './../lib' );
3131
// MAIN //
3232

3333
bench( pkg, function benchmark( b ) {
34+
var rand = uniform( -50.0, 50.0 );
35+
var randC = uniform( EPS, 20.0 + EPS );
3436
var mu;
3537
var c;
3638
var y;
3739
var i;
3840

41+
mu = new Float64Array(b.iterations );
42+
c = new Float64Array( b.iterations );
43+
44+
for ( i = 0; i < b.iterations; i++ ) {
45+
mu[ i ] = randMu();
46+
c[ i ] = randC();
47+
}
48+
3949
b.tic();
4050
for ( i = 0; i < b.iterations; i++ ) {
41-
mu = ( randu()*100.0 ) - 50.0;
42-
c = ( randu()*20.0 ) + EPS;
43-
y = median( mu, c );
51+
y = median( mu[ i ], c[ i ] );
4452
if ( isnan( y ) ) {
4553
b.fail( 'should not return NaN' );
4654
}

lib/node_modules/@stdlib/stats/base/dists/levy/median/test/test.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ tape( 'if provided a nonpositive `c`, the function returns `NaN`', function test
5959
y = median( 2.0, -1.0 );
6060
t.equal( isnan( y ), true, 'returns NaN' );
6161

62-
y = median( 2.0, -1.0 );
63-
t.equal( isnan( y ), true, 'returns NaN' );
64-
6562
y = median( 1.0, NINF );
6663
t.equal( isnan( y ), true, 'returns NaN' );
6764

0 commit comments

Comments
 (0)