Skip to content

Commit 6c6ac62

Browse files
docs: improve doctests for complex number typed arrays in constants
PR-URL: #11979 Reviewed-by: Athan Reines <kgryte@gmail.com> Closes: stdlib-js/metr-issue-tracker#521 Ref: #4833
1 parent b6e7646 commit 6c6ac62

8 files changed

Lines changed: 24 additions & 184 deletions

File tree

lib/node_modules/@stdlib/constants/complex128/nan/README.md

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,33 +56,14 @@ var im = imag( COMPLEX128_NAN );
5656
<!-- eslint no-undef: "error" -->
5757

5858
```javascript
59-
var real = require( '@stdlib/complex/float64/real' );
60-
var imag = require( '@stdlib/complex/float64/imag' );
6159
var Complex128Array = require( '@stdlib/array/complex128' );
6260
var COMPLEX128_NAN = require( '@stdlib/constants/complex128/nan' );
6361

6462
var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] );
65-
// returns <Complex128Array>
66-
67-
var v = x.get( 0 );
68-
// returns <Complex128>
69-
70-
var re = real( v );
71-
// returns 1.0
72-
73-
var im = imag( v );
74-
// returns 2.0
63+
// returns <Complex128Array>[ 1.0, 2.0, 3.0, 4.0 ]
7564

7665
x.fill( COMPLEX128_NAN );
77-
78-
v = x.get( 0 );
79-
// returns <Complex128>
80-
81-
re = real( v );
82-
// returns NaN
83-
84-
im = imag( v );
85-
// returns NaN
66+
// x => <Complex128Array>[ NaN, NaN, NaN, NaN ]
8667
```
8768

8869
</section>

lib/node_modules/@stdlib/constants/complex128/nan/examples/index.js

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,13 @@
1818

1919
'use strict';
2020

21-
var real = require( '@stdlib/complex/float64/real' );
22-
var imag = require( '@stdlib/complex/float64/imag' );
2321
var Complex128Array = require( '@stdlib/array/complex128' );
2422
var COMPLEX128_NAN = require( './../lib' );
2523

2624
var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] );
27-
// returns <Complex128Array>
28-
29-
var v = x.get( 0 );
30-
// returns <Complex128>
31-
32-
var re = real( v );
33-
console.log( re );
34-
// => 1.0
35-
36-
var im = imag( v );
37-
console.log( im );
38-
// => 2.0
25+
console.log( x );
26+
// => <Complex128Array>[ 1.0, 2.0, 3.0, 4.0 ]
3927

4028
x.fill( COMPLEX128_NAN );
41-
42-
v = x.get( 0 );
43-
// returns <Complex128>
44-
45-
re = real( v );
46-
console.log( re );
47-
// => NaN
48-
49-
im = imag( v );
50-
console.log( im );
51-
// => NaN
29+
console.log( x );
30+
// => <Complex128Array>[ NaN, NaN, NaN, NaN ]

lib/node_modules/@stdlib/constants/complex128/zero/README.md

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,33 +56,14 @@ var im = imag( COMPLEX128_ZERO );
5656
<!-- eslint no-undef: "error" -->
5757

5858
```javascript
59-
var real = require( '@stdlib/complex/float64/real' );
60-
var imag = require( '@stdlib/complex/float64/imag' );
6159
var Complex128Array = require( '@stdlib/array/complex128' );
6260
var COMPLEX128_ZERO = require( '@stdlib/constants/complex128/zero' );
6361

6462
var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] );
65-
// returns <Complex128Array>
66-
67-
var v = x.get( 0 );
68-
// returns <Complex128>
69-
70-
var re = real( v );
71-
// returns 1.0
72-
73-
var im = imag( v );
74-
// returns 2.0
63+
// returns <Complex128Array>[ 1.0, 2.0, 3.0, 4.0 ]
7564

7665
x.fill( COMPLEX128_ZERO );
77-
78-
v = x.get( 0 );
79-
// returns <Complex128>
80-
81-
re = real( v );
82-
// returns 0.0
83-
84-
im = imag( v );
85-
// returns 0.0
66+
// x => <Complex128Array>[ 0.0, 0.0, 0.0, 0.0 ]
8667
```
8768

8869
</section>

lib/node_modules/@stdlib/constants/complex128/zero/examples/index.js

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,13 @@
1818

1919
'use strict';
2020

21-
var real = require( '@stdlib/complex/float64/real' );
22-
var imag = require( '@stdlib/complex/float64/imag' );
2321
var Complex128Array = require( '@stdlib/array/complex128' );
2422
var COMPLEX128_ZERO = require( './../lib' );
2523

2624
var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] );
27-
// returns <Complex128Array>
28-
29-
var v = x.get( 0 );
30-
// returns <Complex128>
31-
32-
var re = real( v );
33-
console.log( re );
34-
// => 1.0
35-
36-
var im = imag( v );
37-
console.log( im );
38-
// => 2.0
25+
console.log( x );
26+
// => <Complex128Array>[ 1.0, 2.0, 3.0, 4.0 ]
3927

4028
x.fill( COMPLEX128_ZERO );
41-
42-
v = x.get( 0 );
43-
// returns <Complex128>
44-
45-
re = real( v );
46-
console.log( re );
47-
// => 0.0
48-
49-
im = imag( v );
50-
console.log( im );
51-
// => 0.0
29+
console.log( x );
30+
// => <Complex128Array>[ 0.0, 0.0, 0.0, 0.0 ]

lib/node_modules/@stdlib/constants/complex64/nan/README.md

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,33 +56,14 @@ var im = imagf( COMPLEX64_NAN );
5656
<!-- eslint no-undef: "error" -->
5757

5858
```javascript
59-
var realf = require( '@stdlib/complex/float32/real' );
60-
var imagf = require( '@stdlib/complex/float32/imag' );
6159
var Complex64Array = require( '@stdlib/array/complex64' );
6260
var COMPLEX64_NAN = require( '@stdlib/constants/complex64/nan' );
6361

6462
var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] );
65-
// returns <Complex64Array>
66-
67-
var v = x.get( 0 );
68-
// returns <Complex64>
69-
70-
var re = realf( v );
71-
// returns 1.0
72-
73-
var im = imagf( v );
74-
// returns 2.0
63+
// returns <Complex64Array>[ 1.0, 2.0, 3.0, 4.0 ]
7564

7665
x.fill( COMPLEX64_NAN );
77-
78-
v = x.get( 0 );
79-
// returns <Complex64>
80-
81-
re = realf( v );
82-
// returns NaN
83-
84-
im = imagf( v );
85-
// returns NaN
66+
// x => <Complex64Array>[ NaN, NaN, NaN, NaN ]
8667
```
8768

8869
</section>

lib/node_modules/@stdlib/constants/complex64/nan/examples/index.js

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,13 @@
1818

1919
'use strict';
2020

21-
var realf = require( '@stdlib/complex/float32/real' );
22-
var imagf = require( '@stdlib/complex/float32/imag' );
2321
var Complex64Array = require( '@stdlib/array/complex64' );
2422
var COMPLEX64_NAN = require( './../lib' );
2523

2624
var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] );
27-
// returns <Complex64Array>
28-
29-
var v = x.get( 0 );
30-
// returns <Complex64>
31-
32-
var re = realf( v );
33-
console.log( re );
34-
// => 1.0
35-
36-
var im = imagf( v );
37-
console.log( im );
38-
// => 2.0
25+
console.log( x );
26+
// => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0 ]
3927

4028
x.fill( COMPLEX64_NAN );
41-
42-
v = x.get( 0 );
43-
// returns <Complex64>
44-
45-
re = realf( v );
46-
console.log( re );
47-
// => NaN
48-
49-
im = imagf( v );
50-
console.log( im );
51-
// => NaN
29+
console.log( x );
30+
// => <Complex64Array>[ NaN, NaN, NaN, NaN ]

lib/node_modules/@stdlib/constants/complex64/zero/README.md

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,33 +56,14 @@ var im = imagf( COMPLEX64_ZERO );
5656
<!-- eslint no-undef: "error" -->
5757

5858
```javascript
59-
var realf = require( '@stdlib/complex/float32/real' );
60-
var imagf = require( '@stdlib/complex/float32/imag' );
6159
var Complex64Array = require( '@stdlib/array/complex64' );
6260
var COMPLEX64_ZERO = require( '@stdlib/constants/complex64/zero' );
6361

6462
var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] );
65-
// returns <Complex64Array>
66-
67-
var v = x.get( 0 );
68-
// returns <Complex64>
69-
70-
var re = realf( v );
71-
// returns 1.0
72-
73-
var im = imagf( v );
74-
// returns 2.0
63+
// returns <Complex64Array>[ 1.0, 2.0, 3.0, 4.0 ]
7564

7665
x.fill( COMPLEX64_ZERO );
77-
78-
v = x.get( 0 );
79-
// returns <Complex64>
80-
81-
re = realf( v );
82-
// returns 0.0
83-
84-
im = imagf( v );
85-
// returns 0.0
66+
// x => <Complex64Array>[ 0.0, 0.0, 0.0, 0.0 ]
8667
```
8768

8869
</section>

lib/node_modules/@stdlib/constants/complex64/zero/examples/index.js

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,13 @@
1818

1919
'use strict';
2020

21-
var realf = require( '@stdlib/complex/float32/real' );
22-
var imagf = require( '@stdlib/complex/float32/imag' );
2321
var Complex64Array = require( '@stdlib/array/complex64' );
2422
var COMPLEX64_ZERO = require( './../lib' );
2523

2624
var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] );
27-
// returns <Complex64Array>
28-
29-
var v = x.get( 0 );
30-
// returns <Complex64>
31-
32-
var re = realf( v );
33-
console.log( re );
34-
// => 1.0
35-
36-
var im = imagf( v );
37-
console.log( im );
38-
// => 2.0
25+
console.log( x );
26+
// => <Complex64Array>[ 1.0, 2.0, 3.0, 4.0 ]
3927

4028
x.fill( COMPLEX64_ZERO );
41-
42-
v = x.get( 0 );
43-
// returns <Complex64>
44-
45-
re = realf( v );
46-
console.log( re );
47-
// => 0.0
48-
49-
im = imagf( v );
50-
console.log( im );
51-
// => 0.0
29+
console.log( x );
30+
// => <Complex64Array>[ 0.0, 0.0, 0.0, 0.0 ]

0 commit comments

Comments
 (0)