Skip to content

Commit 2a27875

Browse files
committed
chore: clean-up
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 7531b27 commit 2a27875

File tree

8 files changed

+41
-36
lines changed

8 files changed

+41
-36
lines changed

lib/node_modules/@stdlib/number/float64/base/add/README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,16 @@ v = add( NaN, NaN );
8282
<!-- eslint no-undef: "error" -->
8383

8484
```javascript
85-
var rand = require( '@stdlib/random/base/discrete-uniform' );
85+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
86+
var logEachMap = require( '@stdlib/console/log-each-map' );
8687
var add = require( '@stdlib/number/float64/base/add' );
8788

88-
var x;
89-
var y;
90-
var i;
89+
// Create arrays of random values:
90+
var x = discreteUniform( 100, -50, 50 );
91+
var y = discreteUniform( 100, -50, 50 );
9192

92-
for ( i = 0; i < 100; i++ ) {
93-
x = rand( -50, 50 );
94-
y = rand( -50, 50 );
95-
console.log( '%d + %d = %d', x, y, add( x, y ) );
96-
}
93+
// Perform element-wise addition:
94+
logEachMap( '%d + %d = %d', x, y, add );
9795
```
9896

9997
</section>

lib/node_modules/@stdlib/number/float64/base/add/benchmark/benchmark.js

Lines changed: 7 additions & 5 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 isnan = require( '@stdlib/math/base/assert/is-nan' );
2626
var pkg = require( './../package.json' ).name;
2727
var add = require( './../lib' );
@@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) {
3434
var y;
3535
var i;
3636

37+
x = uniform( 100, -500.0, 500.0 );
38+
3739
b.tic();
3840
for ( i = 0; i < b.iterations; i++ ) {
39-
x = ( randu()*1000.0 ) - 500.0;
40-
y = add( x, 5.0 );
41+
y = add( x[ i%x.length ], 5.0 );
4142
if ( isnan( y ) ) {
4243
b.fail( 'should not return NaN' );
4344
}
@@ -55,10 +56,11 @@ bench( pkg+'::inline', function benchmark( b ) {
5556
var y;
5657
var i;
5758

59+
x = uniform( 100, -500.0, 500.0 );
60+
5861
b.tic();
5962
for ( i = 0; i < b.iterations; i++ ) {
60-
x = ( randu()*1000.0 ) - 500.0;
61-
y = x + 5.0;
63+
y = x[ i%x.length ] + 5.0;
6264
if ( isnan( y ) ) {
6365
b.fail( 'should not return NaN' );
6466
}

lib/node_modules/@stdlib/number/float64/base/add/benchmark/benchmark.native.js

Lines changed: 4 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/base/randu' );
25+
var uniform = require( '@stdlib/random/array/uniform' );
2626
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2727
var tryRequire = require( '@stdlib/utils/try-require' );
2828
var pkg = require( './../package.json' ).name;
@@ -43,10 +43,11 @@ bench( pkg+'::native', opts, function benchmark( b ) {
4343
var y;
4444
var i;
4545

46+
x = uniform( 100, -500.0, 500.0 );
47+
4648
b.tic();
4749
for ( i = 0; i < b.iterations; i++ ) {
48-
x = ( randu()*1000.0 ) - 500.0;
49-
y = add( x, 5.0 );
50+
y = add( x[ i%x.length ], 5.0 );
5051
if ( isnan( y ) ) {
5152
b.fail( 'should not return NaN' );
5253
}

lib/node_modules/@stdlib/number/float64/base/add/benchmark/c/benchmark.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static double rand_double( void ) {
8888
*
8989
* @return sum
9090
*/
91-
double add( const double x, const double y ) {
91+
static double add( const double x, const double y ) {
9292
return x + y;
9393
}
9494

@@ -99,15 +99,18 @@ double add( const double x, const double y ) {
9999
*/
100100
static double benchmark( void ) {
101101
double elapsed;
102-
double x;
102+
double x[ 100 ];
103103
double y;
104104
double t;
105105
int i;
106106

107+
for ( i = 0; i < 100; i++ ) {
108+
x[ i ] = ( 1000.0*rand_double() ) - 500.0;
109+
}
110+
107111
t = tic();
108112
for ( i = 0; i < ITERATIONS; i++ ) {
109-
x = ( 1000.0*rand_double() ) - 500.0;
110-
y = add( x, 5.0 );
113+
y = add( x[ i%100 ], 5.0 );
111114
if ( y != y ) {
112115
printf( "should not return NaN\n" );
113116
break;

lib/node_modules/@stdlib/number/float64/base/add/benchmark/c/native/benchmark.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,18 @@ static double rand_double( void ) {
9191
*/
9292
static double benchmark( void ) {
9393
double elapsed;
94-
double x;
94+
double x[ 100 ];
9595
double y;
9696
double t;
9797
int i;
9898

99+
for ( i = 0; i < 100; i++ ) {
100+
x[ i ] = ( 1000.0*rand_double() ) - 500.0;
101+
}
102+
99103
t = tic();
100104
for ( i = 0; i < ITERATIONS; i++ ) {
101-
x = ( 1000.0*rand_double() ) - 500.0;
102-
y = stdlib_base_float64_add( x, 5.0 );
105+
y = stdlib_base_float64_add( x[ i%100 ], 5.0 );
103106
if ( y != y ) {
104107
printf( "should not return NaN\n" );
105108
break;

lib/node_modules/@stdlib/number/float64/base/add/examples/index.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@
1818

1919
'use strict';
2020

21-
var rand = require( '@stdlib/random/base/discrete-uniform' );
21+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
22+
var logEachMap = require( '@stdlib/console/log-each-map' );
2223
var add = require( './../lib' );
2324

24-
var x;
25-
var y;
26-
var i;
25+
// Create arrays of random values:
26+
var x = discreteUniform( 100, -50, 50 );
27+
var y = discreteUniform( 100, -50, 50 );
2728

28-
for ( i = 0; i < 100; i++ ) {
29-
x = rand( -50, 50 );
30-
y = rand( -50, 50 );
31-
console.log( '%d + %d = %d', x, y, add( x, y ) );
32-
}
29+
// Perform element-wise addition:
30+
logEachMap( '%d + %d = %d', x, y, add );

lib/node_modules/@stdlib/number/float64/base/add/manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
{
2929
"task": "build",
3030
"src": [
31-
"./src/add.c"
31+
"./src/main.c"
3232
],
3333
"include": [
3434
"./include"
@@ -42,7 +42,7 @@
4242
{
4343
"task": "benchmark",
4444
"src": [
45-
"./src/add.c"
45+
"./src/main.c"
4646
],
4747
"include": [
4848
"./include"
@@ -54,7 +54,7 @@
5454
{
5555
"task": "examples",
5656
"src": [
57-
"./src/add.c"
57+
"./src/main.c"
5858
],
5959
"include": [
6060
"./include"

0 commit comments

Comments
 (0)