Skip to content

Commit f1d53f9

Browse files
committed
Auto-generated commit
1 parent d42f095 commit f1d53f9

33 files changed

Lines changed: 201 additions & 125 deletions

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9759,6 +9759,8 @@ A total of 29 people contributed to this release. Thank you to the following con
97599759

97609760
<details>
97619761

9762+
- [`c912eff`](https://github.com/stdlib-js/stdlib/commit/c912eff7b1a6f05304f2f003021b4e47ad1074ab) - **bench:** update random value generation [(#6676)](https://github.com/stdlib-js/stdlib/pull/6676) _(by Harsh)_
9763+
- [`8356484`](https://github.com/stdlib-js/stdlib/commit/835648432cd29ea018a904c15933009987514d44) - **bench:** update random value generation [(#6679)](https://github.com/stdlib-js/stdlib/pull/6679) _(by Harsh)_
97629764
- [`d3089d5`](https://github.com/stdlib-js/stdlib/commit/d3089d54641409dada68d272140566daea12150a) - **bench:** update random value generation [(#6680)](https://github.com/stdlib-js/stdlib/pull/6680) _(by Harsh)_
97639765
- [`abd07ec`](https://github.com/stdlib-js/stdlib/commit/abd07ecd0b265fa4b9b223e258d3d115b88e9a4c) - **docs:** replace manual `for` loop in examples [(#6668)](https://github.com/stdlib-js/stdlib/pull/6668) _(by Harsh, Athan Reines)_
97649766
- [`3b07561`](https://github.com/stdlib-js/stdlib/commit/3b07561dde8d7ee36c60e67c7710c861964f123a) - **bench:** update random value generation [(#6659)](https://github.com/stdlib-js/stdlib/pull/6659) _(by Harsh)_

base/assert/is-even/benchmark/benchmark.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,19 @@ var isEven = require( './../lib' );
3030
// MAIN //
3131

3232
bench( pkg, function benchmark( b ) {
33-
var len;
33+
var opts;
3434
var x;
3535
var y;
3636
var i;
3737

38-
len = 100;
39-
x = discreteUniform( len, 0, 1000 );
38+
opts = {
39+
'dtype': 'float64'
40+
};
41+
x = discreteUniform( 100, 0, 1000, opts );
4042

4143
b.tic();
4244
for ( i = 0; i < b.iterations; i++ ) {
43-
y = isEven( x[ i % len ] );
45+
y = isEven( x[ i % x.length ] );
4446
if ( typeof y !== 'boolean' ) {
4547
b.fail( 'should return a boolean' );
4648
}

base/assert/is-even/benchmark/benchmark.native.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,19 @@ var opts = {
3939
// MAIN //
4040

4141
bench( pkg+'::native', opts, function benchmark( b ) {
42-
var len;
42+
var opts;
4343
var x;
4444
var y;
4545
var i;
4646

47-
len = 100;
48-
x = discreteUniform( len, 0, 1000 );
47+
opts = {
48+
'dtype': 'float64'
49+
};
50+
x = discreteUniform( 100, 0, 1000, opts );
4951

5052
b.tic();
5153
for ( i = 0; i < b.iterations; i++ ) {
52-
y = isEven( x[ i % len ] );
54+
y = isEven( x[ i % x.length ] );
5355
if ( typeof y !== 'boolean' ) {
5456
b.fail( 'should return a boolean' );
5557
}

base/assert/is-even/test/test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ tape( 'the function returns `true` if provided an even number', function test( t
4444
x = round( randu()*1.0e6 ) - 5.0e5;
4545
x *= 2; // always even
4646
bool = isEven( x );
47-
t.equal( bool, true, 'returns true when provided '+x );
47+
t.equal( bool, true, 'returns expected value when provided '+x );
4848
}
4949
t.end();
5050
});
@@ -59,29 +59,29 @@ tape( 'the function returns `false` if provided an odd number', function test( t
5959
x += 1;
6060
}
6161
bool = isEven( x );
62-
t.equal( bool, false, 'returns false when provided '+x );
62+
t.equal( bool, false, 'returns expected value when provided '+x );
6363
}
6464
t.end();
6565
});
6666

6767
tape( 'the function returns `true` if provided `+-0`', function test( t ) {
68-
t.equal( isEven( +0.0 ), true, 'returns true' );
69-
t.equal( isEven( -0.0 ), true, 'returns true' );
68+
t.equal( isEven( +0.0 ), true, 'returns expected value' );
69+
t.equal( isEven( -0.0 ), true, 'returns expected value' );
7070
t.end();
7171
});
7272

7373
tape( 'WARNING: the function returns `true` if provided `+infinity`', function test( t ) {
74-
t.equal( isEven( PINF ), true, 'returns true' );
74+
t.equal( isEven( PINF ), true, 'returns expected value' );
7575
t.end();
7676
});
7777

7878
tape( 'WARNING: the function returns `true` if provided `-infinity`', function test( t ) {
79-
t.equal( isEven( NINF ), true, 'returns true' );
79+
t.equal( isEven( NINF ), true, 'returns expected value' );
8080
t.end();
8181
});
8282

8383
tape( 'the function returns `false` if provided `NaN`', function test( t ) {
84-
t.equal( isEven( NaN ), false, 'returns false' );
85-
t.equal( isEven( 0.0/0.0 ), false, 'returns false' );
84+
t.equal( isEven( NaN ), false, 'returns expected value' );
85+
t.equal( isEven( 0.0/0.0 ), false, 'returns expected value' );
8686
t.end();
8787
});

base/assert/is-even/test/test.native.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ tape( 'the function returns `true` if provided an even number', opts, function t
5353
x = round( randu()*1.0e6 ) - 5.0e5;
5454
x *= 2; // always even
5555
bool = isEven( x );
56-
t.equal( bool, true, 'returns true when provided '+x );
56+
t.equal( bool, true, 'returns expected value when provided '+x );
5757
}
5858
t.end();
5959
});
@@ -68,29 +68,29 @@ tape( 'the function returns `false` if provided an odd number', opts, function t
6868
x += 1;
6969
}
7070
bool = isEven( x );
71-
t.equal( bool, false, 'returns false when provided '+x );
71+
t.equal( bool, false, 'returns expected value when provided '+x );
7272
}
7373
t.end();
7474
});
7575

7676
tape( 'the function returns `true` if provided `+-0`', opts, function test( t ) {
77-
t.equal( isEven( +0.0 ), true, 'returns true' );
78-
t.equal( isEven( -0.0 ), true, 'returns true' );
77+
t.equal( isEven( +0.0 ), true, 'returns expected value' );
78+
t.equal( isEven( -0.0 ), true, 'returns expected value' );
7979
t.end();
8080
});
8181

8282
tape( 'WARNING: the function returns `true` if provided `+infinity`', opts, function test( t ) {
83-
t.equal( isEven( PINF ), true, 'returns true' );
83+
t.equal( isEven( PINF ), true, 'returns expected value' );
8484
t.end();
8585
});
8686

8787
tape( 'WARNING: the function returns `true` if provided `-infinity`', opts, function test( t ) {
88-
t.equal( isEven( NINF ), true, 'returns true' );
88+
t.equal( isEven( NINF ), true, 'returns expected value' );
8989
t.end();
9090
});
9191

9292
tape( 'the function returns `false` if provided `NaN`', opts, function test( t ) {
93-
t.equal( isEven( NaN ), false, 'returns false' );
94-
t.equal( isEven( 0.0/0.0 ), false, 'returns false' );
93+
t.equal( isEven( NaN ), false, 'returns expected value' );
94+
t.equal( isEven( 0.0/0.0 ), false, 'returns expected value' );
9595
t.end();
9696
});

base/assert/is-evenf/benchmark/benchmark.js

Lines changed: 7 additions & 3 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/array/discrete-uniform' );
24+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
2525
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
2626
var pkg = require( './../package.json' ).name;
2727
var isEvenf = require( './../lib' );
@@ -30,15 +30,19 @@ var isEvenf = require( './../lib' );
3030
// MAIN //
3131

3232
bench( pkg, function benchmark( b ) {
33+
var opts;
3334
var x;
3435
var y;
3536
var i;
3637

37-
x = randu( 100, -50, 50 );
38+
opts = {
39+
'dtype': 'float32'
40+
};
41+
x = discreteUniform( 100, -50, 50, opts );
3842

3943
b.tic();
4044
for ( i = 0; i < b.iterations; i++ ) {
41-
y = isEvenf( x[ i % 100 ] );
45+
y = isEvenf( x[ i % x.length ] );
4246
if ( typeof y !== 'boolean' ) {
4347
b.fail( 'should return a boolean' );
4448
}

base/assert/is-evenf/benchmark/benchmark.native.js

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

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench' );
25-
var randu = require( '@stdlib/random/array/discrete-uniform' );
25+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
2626
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
2727
var tryRequire = require( '@stdlib/utils/try-require' );
2828
var pkg = require( './../package.json' ).name;
@@ -39,15 +39,19 @@ var opts = {
3939
// MAIN //
4040

4141
bench( pkg+'::native', opts, function benchmark( b ) {
42+
var opts;
4243
var x;
4344
var y;
4445
var i;
4546

46-
x = randu( 100, -50, 50 );
47+
opts = {
48+
'dtype': 'float32'
49+
};
50+
x = discreteUniform( 100, -50, 50, opts );
4751

4852
b.tic();
4953
for ( i = 0; i < b.iterations; i++ ) {
50-
y = isEvenf( x[ i % 100 ] );
54+
y = isEvenf( x[ i % x.length ] );
5155
if ( typeof y !== 'boolean' ) {
5256
b.fail( 'should return a boolean' );
5357
}

base/assert/is-evenf/test/test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ tape( 'the function returns `true` if provided an even number', function test( t
4444
x = roundf( randu() * 1.0e6 ) - 5.0e5;
4545
x *= 2; // always even
4646
bool = isEvenf( x );
47-
t.equal( bool, true, 'returns true when provided '+x );
47+
t.equal( bool, true, 'returns expected value when provided '+x );
4848
}
4949
t.end();
5050
});
@@ -59,29 +59,29 @@ tape( 'the function returns `false` if provided an odd number', function test( t
5959
x += 1;
6060
}
6161
bool = isEvenf( x );
62-
t.equal( bool, false, 'returns false when provided '+x );
62+
t.equal( bool, false, 'returns expected value when provided '+x );
6363
}
6464
t.end();
6565
});
6666

6767
tape( 'the function returns `true` if provided `+-0`', function test( t ) {
68-
t.equal( isEvenf( +0.0 ), true, 'returns true' );
69-
t.equal( isEvenf( -0.0 ), true, 'returns true' );
68+
t.equal( isEvenf( +0.0 ), true, 'returns expected value' );
69+
t.equal( isEvenf( -0.0 ), true, 'returns expected value' );
7070
t.end();
7171
});
7272

7373
tape( 'WARNING: the function returns `true` if provided `+infinity`', function test( t ) {
74-
t.equal( isEvenf( PINF ), true, 'returns true' );
74+
t.equal( isEvenf( PINF ), true, 'returns expected value' );
7575
t.end();
7676
});
7777

7878
tape( 'WARNING: the function returns `true` if provided `-infinity`', function test( t ) {
79-
t.equal( isEvenf( NINF ), true, 'returns true' );
79+
t.equal( isEvenf( NINF ), true, 'returns expected value' );
8080
t.end();
8181
});
8282

8383
tape( 'the function returns `false` if provided `NaN`', function test( t ) {
84-
t.equal( isEvenf( NaN ), false, 'returns false' );
85-
t.equal( isEvenf( 0.0 / 0.0 ), false, 'returns false' );
84+
t.equal( isEvenf( NaN ), false, 'returns expected value' );
85+
t.equal( isEvenf( 0.0 / 0.0 ), false, 'returns expected value' );
8686
t.end();
8787
});

base/assert/is-evenf/test/test.native.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ tape( 'the function returns `true` if provided an even number', opts, function t
5353
x = roundf( randu() * 1.0e6 ) - 5.0e5;
5454
x *= 2; // always even
5555
bool = isEvenf( x );
56-
t.equal( bool, true, 'returns true when provided '+x );
56+
t.equal( bool, true, 'returns expected value when provided '+x );
5757
}
5858
t.end();
5959
});
@@ -68,29 +68,29 @@ tape( 'the function returns `false` if provided an odd number', opts, function t
6868
x += 1;
6969
}
7070
bool = isEvenf( x );
71-
t.equal( bool, false, 'returns false when provided '+x );
71+
t.equal( bool, false, 'returns expected value when provided '+x );
7272
}
7373
t.end();
7474
});
7575

7676
tape( 'the function returns `true` if provided `+-0`', opts, function test( t ) {
77-
t.equal( isEvenf( +0.0 ), true, 'returns true' );
78-
t.equal( isEvenf( -0.0 ), true, 'returns true' );
77+
t.equal( isEvenf( +0.0 ), true, 'returns expected value' );
78+
t.equal( isEvenf( -0.0 ), true, 'returns expected value' );
7979
t.end();
8080
});
8181

8282
tape( 'WARNING: the function returns `true` if provided `+infinity`', opts, function test( t ) {
83-
t.equal( isEvenf( PINF ), true, 'returns true' );
83+
t.equal( isEvenf( PINF ), true, 'returns expected value' );
8484
t.end();
8585
});
8686

8787
tape( 'WARNING: the function returns `true` if provided `-infinity`', opts, function test( t ) {
88-
t.equal( isEvenf( NINF ), true, 'returns true' );
88+
t.equal( isEvenf( NINF ), true, 'returns expected value' );
8989
t.end();
9090
});
9191

9292
tape( 'the function returns `false` if provided `NaN`', opts, function test( t ) {
93-
t.equal( isEvenf( NaN ), false, 'returns false' );
94-
t.equal( isEvenf( 0.0 / 0.0 ), false, 'returns false' );
93+
t.equal( isEvenf( NaN ), false, 'returns expected value' );
94+
t.equal( isEvenf( 0.0 / 0.0 ), false, 'returns expected value' );
9595
t.end();
9696
});

base/assert/is-finite/benchmark/benchmark.js

Lines changed: 8 additions & 3 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/array/uniform' );
2525
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
2626
var pkg = require( './../package.json' ).name;
2727
var isfinite = require( './../lib' );
@@ -30,14 +30,19 @@ var isfinite = require( './../lib' );
3030
// MAIN //
3131

3232
bench( pkg, function benchmark( b ) {
33+
var opts;
3334
var x;
3435
var y;
3536
var i;
3637

38+
opts = {
39+
'dtype': 'float64'
40+
};
41+
x = uniform( 100, -5.0e6, 5.0e6, opts );
42+
3743
b.tic();
3844
for ( i = 0; i < b.iterations; i++ ) {
39-
x = ( randu()*1.0e7 ) - 5.0e6;
40-
y = isfinite( x );
45+
y = isfinite( x[ i%x.length ] );
4146
if ( typeof y !== 'boolean' ) {
4247
b.fail( 'should return a boolean' );
4348
}

0 commit comments

Comments
 (0)