Skip to content

Commit 2c59b22

Browse files
docs: improve doctests for complex number instances in math/base/special/cround
PR-URL: #9025 Ref: #8641 Co-authored-by: Philipp Burckhardt <pburckhardt@outlook.com> Reviewed-by: Philipp Burckhardt <pburckhardt@outlook.com> Signed-off-by: Philipp Burckhardt <pburckhardt@outlook.com>
1 parent 54a6835 commit 2c59b22

File tree

7 files changed

+16
-115
lines changed

7 files changed

+16
-115
lines changed

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

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,44 +36,18 @@ Rounds each component of a double-precision complex floating-point number to the
3636

3737
```javascript
3838
var Complex128 = require( '@stdlib/complex/float64/ctor' );
39-
var real = require( '@stdlib/complex/float64/real' );
40-
var imag = require( '@stdlib/complex/float64/imag' );
4139

4240
var v = cround( new Complex128( -4.2, 5.5 ) );
43-
// returns <Complex128>
44-
45-
var re = real( v );
46-
// returns -4.0
47-
48-
var im = imag( v );
49-
// returns 6.0
41+
// returns <Complex128>[ -4.0, 6.0 ]
5042

5143
v = cround( new Complex128( 9.99999, 0.1 ) );
52-
// returns <Complex128>
53-
54-
re = real( v );
55-
// returns 10.0
56-
57-
im = imag( v );
58-
// returns 0.0
44+
// returns <Complex128>[ 10.0, 0.0 ]
5945

6046
v = cround( new Complex128( 0.0, 0.0 ) );
61-
// returns <Complex128>
62-
63-
re = real( v );
64-
// returns 0.0
65-
66-
im = imag( v );
67-
// returns 0.0
47+
// returns <Complex128>[ 0.0, 0.0 ]
6848

6949
v = cround( new Complex128( NaN, NaN ) );
70-
// returns <Complex128>
71-
72-
re = real( v );
73-
// returns NaN
74-
75-
im = imag( v );
76-
// returns NaN
50+
// returns <Complex128>[ NaN, NaN ]
7751
```
7852

7953
</section>

lib/node_modules/@stdlib/math/base/special/cround/docs/repl.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@
1616
Examples
1717
--------
1818
> var v = {{alias}}( new {{alias:@stdlib/complex/float64/ctor}}( 5.5, 3.3 ) )
19-
<Complex128>
20-
> var re = {{alias:@stdlib/complex/float64/real}}( v )
21-
6.0
22-
> var im = {{alias:@stdlib/complex/float64/imag}}( v )
23-
3.0
19+
<Complex128>[ 6.0, 3.0 ]
2420

2521
See Also
2622
--------

lib/node_modules/@stdlib/math/base/special/cround/docs/types/index.d.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,7 @@ import { Complex128 } from '@stdlib/types/complex';
3434
* var imag = require( '@stdlib/complex/float64/imag' );
3535
*
3636
* var v = cround( new Complex128( -4.2, 5.5 ) );
37-
* // returns <Complex128>
38-
*
39-
* var re = real( v );
40-
* // returns -4.0
41-
*
42-
* var im = imag( v );
43-
* // returns 6.0
37+
* // returns <Complex128>[ -4.0, 6.0 ]
4438
*/
4539
declare function cround( z: Complex128 ): Complex128;
4640

lib/node_modules/@stdlib/math/base/special/cround/lib/index.js

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,45 +25,19 @@
2525
*
2626
* @example
2727
* var Complex128 = require( '@stdlib/complex/float64/ctor' );
28-
* var real = require( '@stdlib/complex/float64/real' );
29-
* var imag = require( '@stdlib/complex/float64/imag' );
3028
* var cround = require( '@stdlib/math/base/special/cround' );
3129
*
3230
* var v = cround( new Complex128( -4.2, 5.5 ) );
33-
* // returns <Complex128>
34-
*
35-
* var re = real( v );
36-
* // returns -4.0
37-
*
38-
* var im = imag( v );
39-
* // returns 6.0
31+
* // returns <Complex128>[ -4.0, 6.0 ]
4032
*
4133
* v = cround( new Complex128( 9.99999, 0.1 ) );
42-
* // returns <Complex128>
43-
*
44-
* re = real( v );
45-
* // returns 10.0
46-
*
47-
* im = imag( v );
48-
* // returns 0.0
34+
* // returns <Complex128>[ 10.0, 0.0 ]
4935
*
5036
* v = cround( new Complex128( 0.0, 0.0 ) );
51-
* // returns <Complex128>
52-
*
53-
* re = real( v );
54-
* // returns 0.0
55-
*
56-
* im = imag( v );
57-
* // returns 0.0
37+
* // returns <Complex128>[ 0.0, 0.0 ]
5838
*
5939
* v = cround( new Complex128( NaN, NaN ) );
60-
* // returns <Complex128>
61-
*
62-
* re = real( v );
63-
* // returns NaN
64-
*
65-
* im = imag( v );
66-
* // returns NaN
40+
* // returns <Complex128>[ NaN, NaN ]
6741
*/
6842

6943
// MODULES //

lib/node_modules/@stdlib/math/base/special/cround/lib/main.js

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,44 +36,18 @@ var imag = require( '@stdlib/complex/float64/imag' );
3636
*
3737
* @example
3838
* var Complex128 = require( '@stdlib/complex/float64/ctor' );
39-
* var real = require( '@stdlib/complex/float64/real' );
40-
* var imag = require( '@stdlib/complex/float64/imag' );
4139
*
4240
* var v = cround( new Complex128( -4.2, 5.5 ) );
43-
* // returns <Complex128>
44-
*
45-
* var re = real( v );
46-
* // returns -4.0
47-
*
48-
* var im = imag( v );
49-
* // returns 6.0
41+
* // returns <Complex128>[ -4.0, 6.0 ]
5042
*
5143
* v = cround( new Complex128( 9.99999, 0.1 ) );
52-
* // returns <Complex128>
53-
*
54-
* re = real( v );
55-
* // returns 10.0
56-
*
57-
* im = imag( v );
58-
* // returns 0.0
44+
* // returns <Complex128>[ 10.0, 0.0 ]
5945
*
6046
* v = cround( new Complex128( 0.0, 0.0 ) );
61-
* // returns <Complex128>
62-
*
63-
* re = real( v );
64-
* // returns 0.0
65-
*
66-
* im = imag( v );
67-
* // returns 0.0
47+
* // returns <Complex128>[ 0.0, 0.0 ]
6848
*
6949
* v = cround( new Complex128( NaN, NaN ) );
70-
* // returns <Complex128>
71-
*
72-
* re = real( v );
73-
* // returns NaN
74-
*
75-
* im = imag( v );
76-
* // returns NaN
50+
* // returns <Complex128>[ NaN, NaN ]
7751
*/
7852
function cround( z ) {
7953
return new Complex128( round( real( z ) ), round( imag( z ) ) );

lib/node_modules/@stdlib/math/base/special/cround/lib/native.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,7 @@ var addon = require( './../src/addon.node' );
3939
* var imag = require( '@stdlib/complex/float64/imag' );
4040
*
4141
* var v = cround( new Complex128( -4.2, 5.5 ) );
42-
* // returns <Complex128>
43-
*
44-
* var re = real( v );
45-
* // returns -4
46-
*
47-
* var im = imag( v );
48-
* // returns 6.0
42+
* // returns <Complex128>[ -4.0, 6.0 ]
4943
*/
5044
function cround( z ) {
5145
var v = addon( z );

lib/node_modules/@stdlib/math/base/special/cround/src/main.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,7 @@
3535
* stdlib_complex128_t z = stdlib_complex128( -4.2, 5.5 );
3636
*
3737
* stdlib_complex128_t out = stdlib_base_cround( z );
38-
*
39-
* double re = stdlib_complex128_real( out );
40-
* // returns -5.0
41-
*
42-
* double im = stdlib_complex128_imag( out );
43-
* // returns 6.0
38+
* // returns <Complex128>[ -5.0, 6.0 ]
4439
*/
4540
stdlib_complex128_t stdlib_base_cround( const stdlib_complex128_t z ) {
4641
double re;

0 commit comments

Comments
 (0)