Skip to content

Commit b91c103

Browse files
committed
Auto-generated commit
1 parent c07063e commit b91c103

11 files changed

+109
-33
lines changed

.github/.keepalive

-1
This file was deleted.

.github/PULL_REQUEST_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/assert/is-nonpositive-integer) of the main repository where we’ll review and provide feedback.
44

5-
If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib.
5+
If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib.
66

77
We look forward to receiving your contribution! :smiley:

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,7 @@ jsconfig.json
188188
# Other editor files #
189189
######################
190190
.idea/
191+
192+
# Cursor #
193+
##########
194+
.cursorignore

CHANGELOG.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2025-02-02)
7+
## Unreleased (2025-04-15)
88

99
<section class="commits">
1010

1111
### Commits
1212

1313
<details>
1414

15+
- [`f7b18f2`](https://github.com/stdlib-js/stdlib/commit/f7b18f2f07eea6ac092fee7bc7c459fe96b4dd2c) - **bench:** update random value generation [(#6687)](https://github.com/stdlib-js/stdlib/pull/6687) _(by Harsh)_
1516
- [`2ea848b`](https://github.com/stdlib-js/stdlib/commit/2ea848b62b686e1e9d861f7df25ece23a7d80798) - **style:** update to use tabs for indentation _(by Philipp Burckhardt)_
1617
- [`2777e4b`](https://github.com/stdlib-js/stdlib/commit/2777e4be161869d09406e3b17947d24c64b47af2) - **bench:** resolve lint errors in benchmarks _(by Athan Reines)_
1718

@@ -25,9 +26,10 @@
2526

2627
### Contributors
2728

28-
A total of 2 people contributed to this release. Thank you to the following contributors:
29+
A total of 3 people contributed to this release. Thank you to the following contributors:
2930

3031
- Athan Reines
32+
- Harsh
3133
- Philipp Burckhardt
3234

3335
</section>

CONTRIBUTORS

+63-3
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,31 @@
33
# Contributors listed in alphabetical order.
44

55
Aadish Jain <[email protected]>
6+
Aarya Balwadkar <[email protected]>
67
Aayush Khanna <[email protected]>
8+
Abdelrahman Samir <[email protected]>
9+
Abdul Kaium <[email protected]>
10+
Abhay Punia <[email protected]>
711
Abhijit Raut <[email protected]>
12+
Abhishek Jain <[email protected]>
813
Adarsh Palaskar <[email protected]>
914
Aditya Sapra <[email protected]>
1015
Ahmed Atwa <[email protected]>
1116
Ahmed Kashkoush <[email protected]>
1217
Ahmed Khaled <[email protected]>
18+
Aksshay Balasubramanian <[email protected]>
1319
Aleksandr <[email protected]>
1420
Ali Salesi <[email protected]>
21+
AlyAbdelmoneim <[email protected]>
1522
Aman Bhansali <[email protected]>
23+
AmanBhadkariya <[email protected]>
1624
Amit Jimiwal <[email protected]>
25+
Anshu Kumar <[email protected]>
26+
Anshu Kumar <[email protected]>
1727
Anudeep Sanapala <[email protected]>
1828
Athan Reines <[email protected]>
1929
30+
Bhavishy Agrawal <[email protected]>
2031
Brendan Graetz <[email protected]>
2132
Bruno Fenzl <[email protected]>
2233
Bryan Elee <[email protected]>
@@ -26,23 +37,37 @@ Dan Rose <[email protected]>
2637
Daniel Killenberger <[email protected]>
2738
Daniel Yu <[email protected]>
2839
Debashis Maharana <[email protected]>
40+
Deep Trivedi <[email protected]>
2941
Desh Deepak Kant <[email protected]>
3042
43+
Dhanyabad behera <[email protected]>
3144
Dhruv Arvind Singh <[email protected]>
45+
Dhruvil Mehta <[email protected]>
46+
Dipjyoti Das <[email protected]>
3247
Divyansh Seth <[email protected]>
3348
Dominic Lim <[email protected]>
3449
Dominik Moritz <[email protected]>
3550
Dorrin Sotoudeh <[email protected]>
3651
EuniceSim142 <[email protected]>
3752
Frank Kovacs <[email protected]>
53+
GK Bishnoi <[email protected]>
54+
GURU PRASAD SHARMA <[email protected]>
55+
56+
Gautam sharma <[email protected]>
3857
Golden Kumar <[email protected]>
3958
Gunj Joshi <[email protected]>
40-
Gururaj Gurram <[email protected]>
59+
Gururaj Gurram <[email protected]>
60+
Haroon Rasheed <[email protected]>
61+
4162
4263
Harshita Kalani <[email protected]>
64+
Hemant M Mehta <[email protected]>
4365
Hridyanshu <[email protected]>
4466
Jaimin Godhani <[email protected]>
67+
Jaison D Souza <[email protected]>
68+
Jalaj Kumar <[email protected]>
4569
James Gelok <[email protected]>
70+
4671
Jaysukh Makvana <[email protected]>
4772
Jenish Thapa <[email protected]>
4873
Jithin KS <[email protected]>
@@ -51,55 +76,80 @@ Joey Reed <[email protected]>
5176
Jordan Gallivan <[email protected]>
5277
Joris Labie <[email protected]>
5378
Justin Dennison <[email protected]>
54-
Karan Anand <[email protected]>
79+
Justyn Shelby <[email protected]>
80+
Karan Anand <[email protected]>
81+
Karan Yadav <[email protected]>
5582
Karthik Prakash <[email protected]>
83+
Kaushikgtm <[email protected]>
84+
Kavyansh-Bagdi <[email protected]>
5685
Kohantika Nath <[email protected]>
86+
Krishnam Agarwal <[email protected]>
5787
Krishnendu Das <[email protected]>
5888
Kshitij-Dale <[email protected]>
5989
Lovelin Dhoni J B <[email protected]>
90+
91+
Mahfuza Humayra Mohona <[email protected]>
6092
Manik Sharma <[email protected]>
6193
Manvith M <[email protected]>
6294
Marcus Fantham <[email protected]>
6395
Matt Cochrane <[email protected]>
6496
Mihir Pandit <[email protected]>
6597
Milan Raj <[email protected]>
98+
Mohammad Bin Aftab <[email protected]>
6699
Mohammad Kaif <[email protected]>
67100
Momtchil Momtchev <[email protected]>
68101
Muhammad Haris <[email protected]>
102+
Muhammad Taaha Tariq <[email protected]>
103+
Muhmmad Saad <[email protected]>
69104
Naresh Jagadeesan <[email protected]>
70105
Naveen Kumar <[email protected]>
71106
Neeraj Pathak <[email protected]>
107+
NirvedMishra <[email protected]>
72108
Nishant Shinde <[email protected]>
109+
Nishchay Rajput <[email protected]>
73110
Nithin Katta <[email protected]>
74111
Nourhan Hasan <[email protected]>
75112
Ognjen Jevremović <[email protected]>
76113
Oneday12323 <[email protected]>
77114
Ori Miles <[email protected]>
78115
Philipp Burckhardt <[email protected]>
116+
Prajjwal Bajpai <[email protected]>
79117
Prajwal Kulkarni <[email protected]>
80-
Pranav Goswami <[email protected]>
118+
Pranav Goswami <[email protected]>
81119
Pranjal Jha <[email protected]>
82120
Prashant Kumar Yadav <[email protected]>
121+
PrathamBhamare <[email protected]>
83122
Pratik Singh <[email protected]>
84123
Pratyush Kumar Chouhan <[email protected]>
124+
Pravesh Kunwar <[email protected]>
85125
Priyansh Prajapati <[email protected]>
86126
Priyanshu Agarwal <[email protected]>
127+
Pulkit Gupta <[email protected]>
87128
Pushpendra Chandravanshi <[email protected]>
129+
Rahul Kumar <[email protected]>
88130
Raunak Kumar Gupta <[email protected]>
89131
Rejoan Sardar <[email protected]>
90132
Ricky Reusser <[email protected]>
91133
Ridam Garg <[email protected]>
92134
135+
Rishav Tarway <[email protected]>
93136
Robert Gislason <[email protected]>
94137
Roman Stetsyk <[email protected]>
138+
95139
Rutam Kathale <[email protected]>
96140
Ruthwik Chikoti <[email protected]>
97141
Ryan Seal <[email protected]>
98142
Rylan Yang <[email protected]>
143+
SAHIL KUMAR <[email protected]>
144+
SHIVAM YADAV <[email protected]>
145+
Sahil Goyal <[email protected]>
146+
Sai Avinash <[email protected]>
99147
Sai Srikar Dumpeti <[email protected]>
148+
Sanchay Ketan Sinha <[email protected]>
100149
Sarthak Paandey <[email protected]>
101150
Saurabh Singh <[email protected]>
102151
Seyyed Parsa Neshaei <[email protected]>
152+
Shabareesh Shetty <[email protected]>
103153
Shashank Shekhar Singh <[email protected]>
104154
Shivam Ahir <[email protected]>
105155
Shraddheya Shendre <[email protected]>
@@ -110,7 +160,9 @@ Snehil Shah <[email protected]>
110160
Soumajit Chatterjee <[email protected]>
111161
Spandan Barve <[email protected]>
112162
Stephannie Jiménez Gacha <[email protected]>
163+
Suhaib Ilahi <[email protected]>
113164
Suraj Kumar <[email protected]>
165+
Tanishq Ahuja <[email protected]>
114166
Tirtadwipa Manunggal <[email protected]>
115167
Tudor Pagu <[email protected]>
116168
Tufailahmed Bargir <[email protected]>
@@ -124,6 +176,14 @@ Vivek Maurya <[email protected]>
124176
Xiaochuan Ye <[email protected]>
125177
Yaswanth Kosuru <[email protected]>
126178
Yernar Yergaziyev <[email protected]>
179+
Yugal Kaushik <[email protected]>
180+
Yuvi Mittal <[email protected]>
181+
182+
ekambains <[email protected]>
183+
fadiothman22 <[email protected]>
184+
lohithganni <[email protected]>
127185
olenkabilonizhka <[email protected]>
186+
pranav-1720 <[email protected]>
187+
rahulrangers <[email protected]>
128188
129189

benchmark/benchmark.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench-harness' );
24-
var randu = require( '@stdlib/random-base-randu' );
25-
var round = require( '@stdlib/math-base-special-round' );
24+
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
2625
var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;
2726
var pkg = require( './../package.json' ).name;
2827
var isNonPositiveInteger = require( './../lib' );
@@ -31,14 +30,19 @@ var isNonPositiveInteger = require( './../lib' );
3130
// MAIN //
3231

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

38+
opts = {
39+
'dtype': 'float64'
40+
};
41+
x = discreteUniform( 100, -5.0e6, 5.0e6, opts );
42+
3843
b.tic();
3944
for ( i = 0; i < b.iterations; i++ ) {
40-
x = round( (randu()*1.0e7) - 5.0e6 );
41-
y = isNonPositiveInteger( x );
45+
y = isNonPositiveInteger( x[ i%x.length ] );
4246
if ( typeof y !== 'boolean' ) {
4347
b.fail( 'should return a boolean' );
4448
}

benchmark/benchmark.native.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench-harness' );
25-
var randu = require( '@stdlib/random-base-randu' );
26-
var round = require( '@stdlib/math-base-special-round' );
25+
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
2726
var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;
2827
var tryRequire = require( '@stdlib/utils-try-require' );
2928
var pkg = require( './../package.json' ).name;
@@ -40,14 +39,19 @@ var opts = {
4039
// MAIN //
4140

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

47+
opts = {
48+
'dtype': 'float64'
49+
};
50+
x = discreteUniform( 100, -5.0e6, 5.0e6, opts );
51+
4752
b.tic();
4853
for ( i = 0; i < b.iterations; i++ ) {
49-
x = round( (randu()*1.0e7 ) - 5.0e6 );
50-
y = isNonPositiveInteger( x );
54+
y = isNonPositiveInteger( x[ i%x.length ] );
5155
if ( typeof y !== 'boolean' ) {
5256
b.fail( 'should return a boolean' );
5357
}

benchmark/c/native/benchmark.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,18 @@ static double rand_double( void ) {
9292
*/
9393
static double benchmark( void ) {
9494
double elapsed;
95-
double x;
95+
double x[ 100 ];
9696
double t;
9797
bool b;
9898
int i;
9999

100+
for ( i = 0; i < 100; i++ ) {
101+
x[ i ] = ( rand_double() * 200.0 ) - 100.0;
102+
}
103+
100104
t = tic();
101105
for ( i = 0; i < ITERATIONS; i++ ) {
102-
x = ( rand_double() * 200.0 ) - 100.0;
103-
b = stdlib_base_is_nonpositive_integer( x );
106+
b = stdlib_base_is_nonpositive_integer( x[ i%100 ] );
104107
if ( b != true && b != false ) {
105108
printf( "should return either true or false\n" );
106109
break;

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
"@stdlib/boolean-ctor": "^0.2.2",
4949
"@stdlib/constants-float64-ninf": "^0.2.2",
5050
"@stdlib/constants-float64-pinf": "^0.2.2",
51-
"@stdlib/math-base-special-round": "^0.3.0",
5251
"@stdlib/math-base-special-trunc": "^0.2.2",
52+
"@stdlib/random-array-discrete-uniform": "^0.2.1",
5353
"@stdlib/random-base-randu": "^0.2.1",
5454
"@stdlib/utils-try-require": "^0.2.2",
5555
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",

test/test.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ tape( 'main export is a function', function test( t ) {
3939
tape( 'the function returns `false` if provided a positive integer', function test( t ) {
4040
var i;
4141
for ( i = 1; i < 101; i++ ) {
42-
t.equal( isNonPositiveInteger( i ), false, 'returns false when provided '+i );
42+
t.equal( isNonPositiveInteger( i ), false, 'returns expected value when provided '+i );
4343
}
4444
t.end();
4545
});
4646

4747
tape( 'the function returns `true` if provided a nonpositive integer', function test( t ) {
4848
var i;
4949
for ( i = 0; i > -101; i-- ) {
50-
t.equal( isNonPositiveInteger( i ), true, 'returns true when provided '+i );
50+
t.equal( isNonPositiveInteger( i ), true, 'returns expected value when provided '+i );
5151
}
5252
t.end();
5353
});
@@ -58,28 +58,28 @@ tape( 'the function returns `false` if not provided an integer', function test(
5858
for ( i = 0; i < 100; i++ ) {
5959
v = ( randu()*100.0 ) - 50.0;
6060
if ( trunc(v) !== v ) {
61-
t.equal( isNonPositiveInteger( v ), false, 'returns false when provided '+v );
61+
t.equal( isNonPositiveInteger( v ), false, 'returns expected value when provided '+v );
6262
}
6363
}
6464
t.end();
6565
});
6666

6767
tape( 'the function returns `false` if provided `NaN`', function test( t ) {
68-
t.equal( isNonPositiveInteger( NaN ), false, 'returns false' );
68+
t.equal( isNonPositiveInteger( NaN ), false, 'returns expected value' );
6969
t.end();
7070
});
7171

7272
tape( 'WARNING: the function returns `true` if provided `-infinity`', function test( t ) {
73-
t.equal( isNonPositiveInteger( NINF ), true, 'returns true' );
73+
t.equal( isNonPositiveInteger( NINF ), true, 'returns expected value' );
7474
t.end();
7575
});
7676

7777
tape( 'the function does not distinguish between positive and negative zero and returns `true` if provided `+0`', function test( t ) {
78-
t.equal( isNonPositiveInteger( +0.0 ), true, 'returns true' );
78+
t.equal( isNonPositiveInteger( +0.0 ), true, 'returns expected value' );
7979
t.end();
8080
});
8181

8282
tape( 'the function returns `false` if provided `+infinity`', function test( t ) {
83-
t.equal( isNonPositiveInteger( PINF ), false, 'returns false' );
83+
t.equal( isNonPositiveInteger( PINF ), false, 'returns expected value' );
8484
t.end();
8585
});

0 commit comments

Comments
 (0)