Skip to content

Commit ba899ed

Browse files
committed
Auto-generated commit
1 parent 95ebcdc commit ba899ed

File tree

7 files changed

+36
-27
lines changed

7 files changed

+36
-27
lines changed

.github/.keepalive

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

CHANGELOG.md

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

7-
## Unreleased (2025-03-24)
7+
## Unreleased (2025-03-29)
88

99
<section class="reverts">
1010

@@ -22,6 +22,7 @@
2222

2323
<details>
2424

25+
- [`c569d0f`](https://github.com/stdlib-js/stdlib/commit/c569d0ff888bc76a9980f5edb6e1c6f462d6e508) - **bench:** update random value generation [(#6380)](https://github.com/stdlib-js/stdlib/pull/6380) _(by Harsh, Philipp Burckhardt)_
2526
- [`bf5643f`](https://github.com/stdlib-js/stdlib/commit/bf5643fb1a3f32a60903d8e210f71571e609119f) - **docs:** update related packages sections [(#3404)](https://github.com/stdlib-js/stdlib/pull/3404) _(by stdlib-bot)_
2627
- [`b0e68c5`](https://github.com/stdlib-js/stdlib/commit/b0e68c5bc8ee985794eb2ea1791c9337cd15fbd0) - **chore:** update to modern benchmark Makefile _(by Philipp Burckhardt)_
2728
- [`e5ce2d6`](https://github.com/stdlib-js/stdlib/commit/e5ce2d609f303ac075cee06bfc453cddea9d039c) - **revert:** chore: update to modern benchmark Makefile _(by Philipp Burckhardt)_
@@ -37,8 +38,9 @@
3738

3839
### Contributors
3940

40-
A total of 1 person contributed to this release. Thank you to this contributor:
41+
A total of 2 people contributed to this release. Thank you to the following contributors:
4142

43+
- Harsh
4244
- Philipp Burckhardt
4345

4446
</section>

CONTRIBUTORS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ Justyn Shelby <96994781+ShelbyJustyn@users.noreply.github.com>
7878
Karan Anand <119553199+anandkaranubc@users.noreply.github.com>
7979
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
8080
Kaushikgtm <162317291+Kaushikgtm@users.noreply.github.com>
81+
Kavyansh-Bagdi <153486713+Kavyansh-Bagdi@users.noreply.github.com>
8182
Kohantika Nath <145763549+kohantikanath@users.noreply.github.com>
8283
Krishnam Agarwal <83017176+888krishnam@users.noreply.github.com>
8384
Krishnendu Das <86651039+itskdhere@users.noreply.github.com>
@@ -129,6 +130,7 @@ Rutam Kathale <138517416+performant23@users.noreply.github.com>
129130
Ruthwik Chikoti <145591715+ruthwikchikoti@users.noreply.github.com>
130131
Ryan Seal <splrk@users.noreply.github.com>
131132
Rylan Yang <137365285+rylany27@users.noreply.github.com>
133+
SAHIL KUMAR <168997976+sahilk45@users.noreply.github.com>
132134
SHIVAM YADAV <120725381+Shivam-1827@users.noreply.github.com>
133135
Sai Srikar Dumpeti <80447788+the-r3aper7@users.noreply.github.com>
134136
Sanchay Ketan Sinha <122982233+satansin123@users.noreply.github.com>

benchmark/benchmark.js

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

2323
var bench = require( '@stdlib/bench-harness' );
24-
var randu = require( '@stdlib/random-base-randu' );
24+
var uniform = require( '@stdlib/random-array-uniform' );
2525
var isnan = require( '@stdlib/math-base-assert-is-nan' );
2626
var pkg = require( './../package.json' ).name;
2727
var minabsn = require( './../lib' );
@@ -35,11 +35,12 @@ bench( pkg, function benchmark( b ) {
3535
var z;
3636
var i;
3737

38+
x = uniform( 100, -500.0, 500.0 );
39+
y = uniform( 100, -500.0, 500.0 );
40+
3841
b.tic();
3942
for ( i = 0; i < b.iterations; i++ ) {
40-
x = ( randu()*1000.0 ) - 500.0;
41-
y = ( randu()*1000.0 ) - 500.0;
42-
z = minabsn( x, y );
43+
z = minabsn( x[ i%x.length ], y[ i%y.length ] );
4344
if ( isnan( z ) ) {
4445
b.fail( 'should not return NaN' );
4546
}
@@ -58,11 +59,12 @@ bench( pkg+'::built-in', function benchmark( b ) {
5859
var z;
5960
var i;
6061

62+
x = uniform( 100, -500.0, 500.0 );
63+
y = uniform( 100, -500.0, 500.0 );
64+
6165
b.tic();
6266
for ( i = 0; i < b.iterations; i++ ) {
63-
x = ( randu()*1000.0 ) - 500.0;
64-
y = ( randu()*1000.0 ) - 500.0;
65-
z = Math.min( Math.abs( x ), Math.abs( y ) ); // eslint-disable-line stdlib/no-builtin-math
67+
z = Math.min( Math.abs( x[ i%x.length ] ), Math.abs( y[ i%y.length ] ) ); // eslint-disable-line stdlib/no-builtin-math
6668
if ( isnan( z ) ) {
6769
b.fail( 'should not return NaN' );
6870
}

benchmark/c/benchmark.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,20 @@ static double rand_double( void ) {
9090
*/
9191
static double benchmark( void ) {
9292
double elapsed;
93-
double x;
94-
double y;
93+
double x[ 100 ];
94+
double y[ 100 ];
9595
double z;
9696
double t;
9797
int i;
9898

99+
for ( i = 0; i < 100; i++ ) {
100+
x[ i ] = ( 1000.0*rand_double() ) - 500.0;
101+
y[ i ] = ( 1000.0*rand_double() ) - 500.0;
102+
}
103+
99104
t = tic();
100105
for ( i = 0; i < ITERATIONS; i++ ) {
101-
x = ( 1000.0*rand_double() ) - 500.0;
102-
y = ( 1000.0*rand_double() ) - 500.0;
103-
z = fmin( fabs(x), fabs(y) );
106+
z = fmin( fabs(x[ i%100 ]), fabs(y[ i%100 ]) );
104107
if ( z != z ) {
105108
printf( "should not return NaN\n" );
106109
break;

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"@stdlib/constants-float64-ninf": "^0.2.2",
4646
"@stdlib/math-base-assert-is-nan": "^0.2.2",
4747
"@stdlib/math-base-assert-is-positive-zero": "^0.2.2",
48+
"@stdlib/random-array-uniform": "^0.2.1",
4849
"@stdlib/random-base-randu": "^0.2.1",
4950
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
5051
"istanbul": "^0.4.1",

test/test.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,49 +40,49 @@ tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) {
4040
var v;
4141

4242
v = minabsn( NaN, 3.14 );
43-
t.strictEqual( isnan( v ), true, 'returns NaN' );
43+
t.strictEqual( isnan( v ), true, 'returns expected value' );
4444

4545
v = minabsn( 3.14, NaN );
46-
t.strictEqual( isnan( v ), true, 'returns NaN' );
46+
t.strictEqual( isnan( v ), true, 'returns expected value' );
4747

4848
v = minabsn( NaN );
49-
t.strictEqual( isnan( v ), true, 'returns NaN' );
49+
t.strictEqual( isnan( v ), true, 'returns expected value' );
5050

5151
v = minabsn( 3.14, 4.2, NaN );
52-
t.strictEqual( isnan( v ), true, 'returns NaN' );
52+
t.strictEqual( isnan( v ), true, 'returns expected value' );
5353

5454
t.end();
5555
});
5656

5757
tape( 'the function returns `+infinity` if not provided any arguments', function test( t ) {
5858
var v = minabsn();
59-
t.strictEqual( v, PINF, 'returns +infinity' );
59+
t.strictEqual( v, PINF, 'returns expected value' );
6060
t.end();
6161
});
6262

6363
tape( 'the function returns a correctly signed zero', function test( t ) {
6464
var v;
6565

6666
v = minabsn( +0.0, -0.0 );
67-
t.strictEqual( isPositiveZero( v ), true, 'returns +0' );
67+
t.strictEqual( isPositiveZero( v ), true, 'returns expected value' );
6868

6969
v = minabsn( -0.0, +0.0 );
70-
t.strictEqual( isPositiveZero( v ), true, 'returns +0' );
70+
t.strictEqual( isPositiveZero( v ), true, 'returns expected value' );
7171

7272
v = minabsn( -0.0, -0.0 );
73-
t.strictEqual( isPositiveZero( v ), true, 'returns +0' );
73+
t.strictEqual( isPositiveZero( v ), true, 'returns expected value' );
7474

7575
v = minabsn( +0.0, +0.0 );
76-
t.strictEqual( isPositiveZero( v ), true, 'returns +0' );
76+
t.strictEqual( isPositiveZero( v ), true, 'returns expected value' );
7777

7878
v = minabsn( -0.0 );
79-
t.strictEqual( isPositiveZero( v ), true, 'returns +0' );
79+
t.strictEqual( isPositiveZero( v ), true, 'returns expected value' );
8080

8181
v = minabsn( +0.0 );
82-
t.strictEqual( isPositiveZero( v ), true, 'returns +0' );
82+
t.strictEqual( isPositiveZero( v ), true, 'returns expected value' );
8383

8484
v = minabsn( +0.0, -0.0, +0.0 );
85-
t.strictEqual( isPositiveZero( v ), true, 'returns +0' );
85+
t.strictEqual( isPositiveZero( v ), true, 'returns expected value' );
8686

8787
t.end();
8888
});

0 commit comments

Comments
 (0)