Skip to content

Commit 3c14a0f

Browse files
authored
docs: replace manual for loop in examples
PR-URL: #6643 Reviewed-by: Athan Reines <[email protected]>
1 parent 840d733 commit 3c14a0f

File tree

6 files changed

+42
-36
lines changed

6 files changed

+42
-36
lines changed

lib/node_modules/@stdlib/math/base/special/tan/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,17 @@ v = tan( NaN );
8080
<!-- eslint no-undef: "error" -->
8181

8282
```javascript
83-
var linspace = require( '@stdlib/array/base/linspace' );
83+
var uniform = require( '@stdlib/random/array/uniform' );
84+
var logEachMap = require( '@stdlib/console/log-each-map' );
8485
var PI = require( '@stdlib/constants/float64/pi' );
8586
var tan = require( '@stdlib/math/base/special/tan' );
8687

87-
var x = linspace( -PI/2.0, PI/2.0, 100 );
88+
var opts = {
89+
'dtype': 'float64'
90+
};
91+
var x = uniform( 100, -PI/2.0, PI/2.0, opts );
8892

89-
var i;
90-
for ( i = 0; i < x.length; i++ ) {
91-
console.log( tan( x[ i ] ) );
92-
}
93+
logEachMap( 'tan(%0.4f) = %0.4f', x, tan );
9394
```
9495

9596
</section>

lib/node_modules/@stdlib/math/base/special/tan/examples/index.js

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

1919
'use strict';
2020

21-
var linspace = require( '@stdlib/array/base/linspace' );
21+
var uniform = require( '@stdlib/random/array/uniform' );
22+
var logEachMap = require( '@stdlib/console/log-each-map' );
2223
var PI = require( '@stdlib/constants/float64/pi' );
2324
var tan = require( './../lib' );
2425

25-
var x = linspace( -PI/2.0, PI/2.0, 100 );
26+
var opts = {
27+
'dtype': 'float64'
28+
};
29+
var x = uniform( 100, -PI/2.0, PI/2.0, opts );
2630

27-
var i;
28-
for ( i = 0; i < x.length; i++ ) {
29-
console.log( 'tan(%d) = %d', x[ i ], tan( x[ i ] ) );
30-
}
31+
logEachMap( 'tan(%0.4f) = %0.4f', x, tan );

lib/node_modules/@stdlib/math/base/special/tand/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,16 @@ v = tand( NaN );
6363
<!-- eslint no-undef: "error" -->
6464

6565
```javascript
66-
var linspace = require( '@stdlib/array/base/linspace' );
66+
var uniform = require( '@stdlib/random/array/uniform' );
67+
var logEachMap = require( '@stdlib/console/log-each-map' );
6768
var tand = require( '@stdlib/math/base/special/tand' );
6869

69-
var x = linspace( -180, 180, 100 );
70+
var opts = {
71+
'dtype': 'float64'
72+
};
73+
var x = uniform( 100, -180.0, 180.0, opts );
7074

71-
var i;
72-
for ( i = 0; i < x.length; i++ ) {
73-
console.log( tand( x[ i ] ) );
74-
}
75+
logEachMap( 'tand(%0.4f) = %0.4f', x, tand );
7576
```
7677

7778
</section>

lib/node_modules/@stdlib/math/base/special/tand/examples/index.js

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

1919
'use strict';
2020

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

24-
var x = linspace( -180, 180, 100 );
25+
var opts = {
26+
'dtype': 'float64'
27+
};
28+
var x = uniform( 100, -180.0, 180.0, opts );
2529

26-
var i;
27-
for ( i = 0; i < x.length; i++ ) {
28-
console.log( 'tand(%d) = %d', x[ i ], tand( x[ i ] ) );
29-
}
30+
logEachMap( 'tand(%0.4f) = %0.4f', x, tand );

lib/node_modules/@stdlib/math/base/special/tanh/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,16 @@ v = tanh( NaN );
6262
<!-- eslint no-undef: "error" -->
6363

6464
```javascript
65-
var linspace = require( '@stdlib/array/base/linspace' );
65+
var uniform = require( '@stdlib/random/array/uniform' );
66+
var logEachMap = require( '@stdlib/console/log-each-map' );
6667
var tanh = require( '@stdlib/math/base/special/tanh' );
6768

68-
var x = linspace( -4.0, 4.0, 100 );
69+
var opts = {
70+
'dtype': 'float64'
71+
};
72+
var x = uniform( 100, -4.0, 4.0, opts );
6973

70-
var i;
71-
for ( i = 0; i < x.length; i++ ) {
72-
console.log( tanh( x[ i ] ) );
73-
}
74+
logEachMap( 'tanh(%0.4f) = %0.4f', x, tanh );
7475
```
7576

7677
</section>

lib/node_modules/@stdlib/math/base/special/tanh/examples/index.js

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

1919
'use strict';
2020

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

24-
var x = linspace( -4.0, 4.0, 100 );
25+
var opts = {
26+
'dtype': 'float64'
27+
};
28+
var x = uniform( 100, -4.0, 4.0, opts );
2529

26-
var i;
27-
for ( i = 0; i < x.length; i++ ) {
28-
console.log( 'tanh(%d) = %d', x[ i ], tanh( x[ i ] ) );
29-
}
30+
logEachMap( 'tanh(%0.4f) = %0.4f', x, tanh );

0 commit comments

Comments
 (0)