Skip to content

Commit 9d2d2d0

Browse files
authored
docs: improve doctests for complex number instances in math/base/special/cfloorn
PR-URL: #9284 Ref: #8641 Reviewed-by: Athan Reines <kgryte@gmail.com>
1 parent 1a8bdaa commit 9d2d2d0

File tree

6 files changed

+19
-143
lines changed

6 files changed

+19
-143
lines changed

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

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -36,47 +36,21 @@ 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
// Round components to 2 decimal places:
4341
var v = cfloorn( new Complex128( -3.141592653589793, 3.141592653589793 ), -2 );
44-
// returns <Complex128>
45-
46-
var re = real( v );
47-
// returns -3.15
48-
49-
var im = imag( v );
50-
// returns 3.14
42+
// returns <Complex128>[ -3.15, 3.14 ]
5143

5244
// If n = 0, `cfloorn` behaves like `cfloor`:
5345
v = cfloorn( new Complex128( -3.141592653589793, 3.141592653589793 ), 0 );
54-
// returns <Complex128>
55-
56-
re = real( v );
57-
// returns -4.0
58-
59-
im = imag( v );
60-
// returns 3.0
46+
// returns <Complex128>[ -4.0, 3.0 ]
6147

6248
// Round components to the nearest thousand:
6349
v = cfloorn( new Complex128( -12368.0, 12368.0 ), 3 );
64-
// returns <Complex128>
65-
66-
re = real( v );
67-
// returns -13000.0
68-
69-
im = imag( v );
70-
// returns 12000.0
50+
// returns <Complex128>[ -13000.0, 12000.0 ]
7151

7252
v = cfloorn( new Complex128( NaN, NaN ), 0 );
73-
// returns <Complex128>
74-
75-
re = real( v );
76-
// returns NaN
77-
78-
im = imag( v );
79-
// returns NaN
53+
// returns <Complex128>[ NaN, NaN ]
8054
```
8155

8256
</section>
@@ -91,21 +65,13 @@ im = imag( v );
9165

9266
```javascript
9367
var Complex128 = require( '@stdlib/complex/float64/ctor' );
94-
var real = require( '@stdlib/complex/float64/real' );
95-
var imag = require( '@stdlib/complex/float64/imag' );
9668

9769
var x = -0.2 - 0.1;
9870
// returns -0.30000000000000004
9971

10072
// Should round components to 0.3:
10173
var v = cfloorn( new Complex128( x, x ), -16 );
102-
// returns <Complex128>
103-
104-
var re = real( v );
105-
// returns -0.3000000000000001
106-
107-
var im = imag( v );
108-
// returns -0.3000000000000001
74+
// returns <Complex128>[ -0.3000000000000001, -0.3000000000000001 ]
10975
```
11076

11177
</section>

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@
1919
Examples
2020
--------
2121
> var v = {{alias}}( new {{alias:@stdlib/complex/float64/ctor}}( 5.555, -3.333 ), -2 )
22-
<Complex128>
23-
> var re = {{alias:@stdlib/complex/float64/real}}( v )
24-
5.55
25-
> var im = {{alias:@stdlib/complex/float64/imag}}( v )
26-
-3.34
22+
<Complex128>[ 5.55, -3.34 ]
2723

2824
See Also
2925
--------

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,9 @@ import { Complex128 } from '@stdlib/types/complex';
3131
*
3232
* @example
3333
* var Complex128 = require( '@stdlib/complex/float64/ctor' );
34-
* var real = require( '@stdlib/complex/float64/real' );
35-
* var imag = require( '@stdlib/complex/float64/imag' );
3634
*
3735
* var v = cfloorn( new Complex128( 5.555, -3.333 ), -2 );
38-
* // returns <Complex128>
39-
*
40-
* var re = real( v );
41-
* // returns 5.55
42-
*
43-
* var im = imag( v );
44-
* // returns -3.34
36+
* // returns <Complex128>[ 5.55, -3.34 ]
4537
*/
4638
declare function cfloorn( z: Complex128, n: number ): Complex128;
4739

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

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,48 +25,22 @@
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 cfloorn = require( '@stdlib/math/base/special/cfloorn' );
3129
*
3230
* // Round components to 2 decimal places:
3331
* var v = cfloorn( new Complex128( -3.141592653589793, 3.141592653589793 ), -2 );
34-
* // returns <Complex128>
35-
*
36-
* var re = real( v );
37-
* // returns -3.15
38-
*
39-
* var im = imag( v );
40-
* // returns 3.14
32+
* // returns <Complex128>[ -3.15, 3.14 ]
4133
*
4234
* // If n = 0, `cfloorn` behaves like `cfloor`:
4335
* v = cfloorn( new Complex128( 9.99999, 0.1 ), 0 );
44-
* // returns <Complex128>
45-
*
46-
* re = real( v );
47-
* // returns 9.0
48-
*
49-
* im = imag( v );
50-
* // returns 0.0
36+
* // returns <Complex128>[ 9.0, 0.0 ]
5137
*
5238
* // Round components to the nearest thousand:
5339
* v = cfloorn( new Complex128( 12368.0, -12368.0 ), 2 );
54-
* // returns <Complex128>
55-
*
56-
* re = real( v );
57-
* // returns 12300.0
58-
*
59-
* im = imag( v );
60-
* // returns -12400.0
40+
* // returns <Complex128>[ 12300.0, -12400.0 ]
6141
*
6242
* v = cfloorn( new Complex128( NaN, NaN ), 2 );
63-
* // returns <Complex128>
64-
*
65-
* re = real( v );
66-
* // returns NaN
67-
*
68-
* im = imag( v );
69-
* // returns NaN
43+
* // returns <Complex128>[ NaN, NaN ]
7044
*/
7145

7246
// MODULES //

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

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,47 +37,21 @@ var imag = require( '@stdlib/complex/float64/imag' );
3737
*
3838
* @example
3939
* var Complex128 = require( '@stdlib/complex/float64/ctor' );
40-
* var real = require( '@stdlib/complex/float64/real' );
41-
* var imag = require( '@stdlib/complex/float64/imag' );
4240
*
4341
* // Round components to 2 decimal places:
4442
* var v = cfloorn( new Complex128( -3.141592653589793, 3.141592653589793 ), -2 );
45-
* // returns <Complex128>
46-
*
47-
* var re = real( v );
48-
* // returns -3.15
49-
*
50-
* var im = imag( v );
51-
* // returns 3.14
43+
* // returns <Complex128>[ -3.15, 3.14 ]
5244
*
5345
* // If n = 0, `cfloorn` behaves like `cfloor`:
5446
* v = cfloorn( new Complex128( 9.99999, 0.1 ), 0 );
55-
* // returns <Complex128>
56-
*
57-
* re = real( v );
58-
* // returns 9.0
59-
*
60-
* im = imag( v );
61-
* // returns 0.0
47+
* // returns <Complex128>[ 9.0, 0.0 ]
6248
*
6349
* // Round components to the nearest thousand:
6450
* v = cfloorn( new Complex128( 12368.0, -12368.0 ), 2 );
65-
* // returns <Complex128>
66-
*
67-
* re = real( v );
68-
* // returns 12300
69-
*
70-
* im = imag( v );
71-
* // returns -12400
51+
* // returns <Complex128>[ 12300.0, -12400.0 ]
7252
*
7353
* v = cfloorn( new Complex128( NaN, NaN ), 2 );
74-
* // returns <Complex128>
75-
*
76-
* re = real( v );
77-
* // returns NaN
78-
*
79-
* im = imag( v );
80-
* // returns NaN
54+
* // returns <Complex128>[ NaN, NaN ]
8155
*/
8256
function cfloorn( z, n ) {
8357
return new Complex128( floorn( real( z ), n ), floorn( imag( z ), n ) );

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

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,47 +36,21 @@ var addon = require( './../src/addon.node' );
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
* // Round components to 2 decimal places:
4341
* var v = cfloorn( new Complex128( -3.141592653589793, 3.141592653589793 ), -2 );
44-
* // returns <Complex128>
45-
*
46-
* var re = real( v );
47-
* // returns -3.15
48-
*
49-
* var im = imag( v );
50-
* // returns 3.14
42+
* // returns <Complex128>[ -3.15, 3.14 ]
5143
*
5244
* // If n = 0, `cfloorn` behaves like `cfloor`:
5345
* v = cfloorn( new Complex128( 9.99999, 0.1 ), 0 );
54-
* // returns <Complex128>
55-
*
56-
* re = real( v );
57-
* // returns 9.0
58-
*
59-
* im = imag( v );
60-
* // returns 0.0
46+
* // returns <Complex128>[ 9.0, 0.0 ]
6147
*
6248
* // Round components to the nearest thousand:
6349
* v = cfloorn( new Complex128( 12368.0, -12368.0 ), 2 );
64-
* // returns <Complex128>
65-
*
66-
* re = real( v );
67-
* // returns 12300
68-
*
69-
* im = imag( v );
70-
* // returns -12400
50+
* // returns <Complex128>[ 12300.0, -12400.0 ]
7151
*
7252
* v = cfloorn( new Complex128( NaN, NaN ), 2 );
73-
* // returns <Complex128>
74-
*
75-
* re = real( v );
76-
* // returns NaN
77-
*
78-
* im = imag( v );
79-
* // returns NaN
53+
* // returns <Complex128>[ NaN, NaN ]
8054
*/
8155
function cfloorn( z, n ) {
8256
var v = addon( z, n );

0 commit comments

Comments
 (0)