Skip to content

Commit 1348c5d

Browse files
sujal sunil chaudharysujal sunil chaudhary
authored andcommitted
docs/improve-math-base-special-cceiln
1 parent 4304bee commit 1348c5d

File tree

6 files changed

+20
-153
lines changed

6 files changed

+20
-153
lines changed

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

Lines changed: 6 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -36,50 +36,24 @@ 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 z = new Complex128( -3.141592653589793, 3.141592653589793 );
4442
var v = cceiln( z, -2 );
45-
// returns <Complex128>
46-
47-
var re = real( v );
48-
// returns -3.14
49-
50-
var im = imag( v );
51-
// returns 3.15
43+
// returns <Complex128>[ -3.14, 3.15 ]
5244

5345
// If n = 0, `cceiln` behaves like `cceil`:
5446
z = new Complex128( 9.99999, 0.1 );
5547
v = cceiln( z, 0 );
56-
// returns <Complex128>
57-
58-
re = real( v );
59-
// returns 10.0
60-
61-
im = imag( v );
62-
// returns 1.0
48+
// returns <Complex128>[ 10.0, 1.0 ]
6349

6450
// Round components to the nearest thousand:
6551
z = new Complex128( 12368.0, -12368.0 );
6652
v = cceiln( z, 3 );
67-
// returns <Complex128>
68-
69-
re = real( v );
70-
// returns 13000.0
71-
72-
im = imag( v );
73-
// returns -12000.0
53+
// returns <Complex128>[ 13000.0, -12000.0 ]
7454

7555
v = cceiln( new Complex128( NaN, NaN ), 2 );
76-
// returns <Complex128>
77-
78-
re = real( v );
79-
// returns NaN
80-
81-
im = imag( v );
82-
// returns NaN
56+
// returns <Complex128>[ NaN, NaN ]
8357
```
8458

8559
</section>
@@ -94,21 +68,13 @@ im = imag( v );
9468

9569
```javascript
9670
var Complex128 = require( '@stdlib/complex/float64/ctor' );
97-
var real = require( '@stdlib/complex/float64/real' );
98-
var imag = require( '@stdlib/complex/float64/imag' );
9971

10072
var x = 0.2 + 0.1;
10173
// returns 0.30000000000000004
10274

10375
// Should round components to 0.3:
10476
var v = cceiln( new Complex128( x, x ), -16 );
105-
// returns <Complex128>
106-
107-
var re = real( v );
108-
// returns 0.3000000000000001
109-
110-
var im = imag( v );
111-
// returns 0.3000000000000001
77+
// returns <Complex128>[ 0.3000000000000001, 0.3000000000000001 ]
11278
```
11379

11480
</section>
@@ -177,18 +143,11 @@ Rounds each component of a double-precision complex floating-point number to the
177143

178144
```c
179145
#include "stdlib/complex/float64/ctor.h"
180-
#include "stdlib/complex/float64/real.h"
181-
#include "stdlib/complex/float64/imag.h"
182146
183147
stdlib_complex128_t z = stdlib_complex128( -3.141592653589793, 3.141592653589793 );
184148
185149
stdlib_complex128_t out = stdlib_base_cceiln( z, -2 );
186-
187-
double re = stdlib_complex128_real( out );
188-
// returns -3.14
189-
190-
double im = stdlib_complex128_imag( out );
191-
// returns 3.15
150+
// returns <Complex128>[ -3.14, 3.15 ]
192151
```
193152

194153
The function accepts the following arguments:

lib/node_modules/@stdlib/math/base/special/cceiln/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 out = {{alias}}( new {{alias:@stdlib/complex/float64/ctor}}( 5.555, -3.333 ), -2 )
22-
<Complex128>
23-
> var re = {{alias:@stdlib/complex/float64/real}}( out )
24-
5.56
25-
> var im = {{alias:@stdlib/complex/float64/imag}}( out )
26-
-3.33
22+
<Complex128>[ 5.56, -3.33 ]
2723

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

lib/node_modules/@stdlib/math/base/special/cceiln/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 = cceiln( new Complex128( 5.555, -3.333 ), -2 );
38-
* // returns <Complex128>
39-
*
40-
* var re = real( v );
41-
* // returns 5.56
42-
*
43-
* var im = imag( v );
44-
* // returns -3.33
36+
* // returns <Complex128>[ 5.56, -3.33 ]
4537
*/
4638
declare function cceiln( z: Complex128, n: number ): Complex128;
4739

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

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,51 +25,25 @@
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 cceiln = require( '@stdlib/math/base/special/cceiln' );
3129
*
3230
* // Round components to 2 decimal places:
3331
* var z = new Complex128( -3.141592653589793, 3.141592653589793 )
3432
* var v = cceiln( z, -2 );
35-
* // returns <Complex128>
36-
*
37-
* var re = real( v );
38-
* // returns -3.14
39-
*
40-
* var im = imag( v );
41-
* // returns 3.15
33+
* // returns <Complex128>[ -3.14, 3.15 ]
4234
*
4335
* // If n = 0, `cceiln` behaves like `cceil`:
4436
* z = new Complex128( 9.99999, 0.1 )
4537
* v = cceiln( z, 0 );
46-
* // returns <Complex128>
47-
*
48-
* re = real( v );
49-
* // returns 10.0
50-
*
51-
* im = imag( v );
52-
* // returns 1.0
38+
* // returns <Complex128>[ 10.0, 1.0 ]
5339
*
5440
* // Round components to the nearest thousand:
5541
* z = new Complex128( 12368.0, -12368.0 )
5642
* v = cceiln( z, 3 );
57-
* // returns <Complex128>
58-
*
59-
* re = real( v );
60-
* // returns 13000.0
61-
*
62-
* im = imag( v );
63-
* // returns -12000.0
43+
* // returns <Complex128>[ 13000.0, -12000.0 ]
6444
*
6545
* v = cceiln( new Complex128( NaN, NaN ), 2 );
66-
* // returns <Complex128>
67-
*
68-
* re = real( v );
69-
* // returns NaN
70-
*
71-
* im = imag( v );
72-
* // returns NaN
46+
* // returns <Complex128>[ NaN, NaN ]
7347
*/
7448

7549
// MODULES //

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

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
var ceiln = require( '@stdlib/math/base/special/ceiln' );
2424
var Complex128 = require( '@stdlib/complex/float64/ctor' );
25-
var real = require( '@stdlib/complex/float64/real' );
26-
var imag = require( '@stdlib/complex/float64/imag' );
2725

2826

2927
// MAIN //
@@ -37,50 +35,24 @@ var imag = require( '@stdlib/complex/float64/imag' );
3735
*
3836
* @example
3937
* var Complex128 = require( '@stdlib/complex/float64/ctor' );
40-
* var real = require( '@stdlib/complex/float64/real' );
41-
* var imag = require( '@stdlib/complex/float64/imag' );
4238
*
4339
* // Round components to 2 decimal places:
4440
* var z = new Complex128( -3.141592653589793, 3.141592653589793 )
4541
* var v = cceiln( z, -2 );
46-
* // returns <Complex128>
47-
*
48-
* var re = real( v );
49-
* // returns -3.14
50-
*
51-
* var im = imag( v );
52-
* // returns 3.15
42+
* // returns <Complex128>[ -3.14, 3.15 ]
5343
*
5444
* // If n = 0, `cceiln` behaves like `cceil`:
5545
* z = new Complex128( 9.99999, 0.1 )
5646
* v = cceiln( z, 0 );
57-
* // returns <Complex128>
58-
*
59-
* re = real( v );
60-
* // returns 10.0
61-
*
62-
* im = imag( v );
63-
* // returns 1.0
47+
* // returns <Complex128>[ 10.0, 1.0 ]
6448
*
6549
* // Round components to the nearest thousand:
6650
* z = new Complex128( 12368.0, -12368.0 )
6751
* v = cceiln( z, 3 );
68-
* // returns <Complex128>
69-
*
70-
* re = real( v );
71-
* // returns 13000.0
72-
*
73-
* im = imag( v );
74-
* // returns -12000.0
52+
* // returns <Complex128>[ 13000.0, -12000.0 ]
7553
*
7654
* v = cceiln( new Complex128( NaN, NaN ), 2 );
77-
* // returns <Complex128>
78-
*
79-
* re = real( v );
80-
* // returns NaN
81-
*
82-
* im = imag( v );
83-
* // returns NaN
55+
* // returns <Complex128>[ NaN, NaN ]
8456
*/
8557
function cceiln( z, n ) {
8658
return new Complex128( ceiln( real( z ), n ), ceiln( imag( z ), n ) );

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

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,50 +36,24 @@ 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 z = new Complex128( -3.141592653589793, 3.141592653589793 )
4442
* var v = cceiln( z, -2 );
45-
* // returns <Complex128>
46-
*
47-
* var re = real( v );
48-
* // returns -3.14
49-
*
50-
* var im = imag( v );
51-
* // returns 3.15
43+
* // returns <Complex128>[ -3.14, 3.15 ]
5244
*
5345
* // If n = 0, `cceiln` behaves like `cceil`:
5446
* z = new Complex128( 9.99999, 0.1 )
5547
* v = cceiln( z, 0 );
56-
* // returns <Complex128>
57-
*
58-
* re = real( v );
59-
* // returns 10.0
60-
*
61-
* im = imag( v );
62-
* // returns 1.0
48+
* // returns <Complex128>[ 10.0, 1.0 ]
6349
*
6450
* // Round components to the nearest thousand:
6551
* z = new Complex128( 12368.0, -12368.0 )
6652
* v = cceiln( z, 3 );
67-
* // returns <Complex128>
68-
*
69-
* re = real( v );
70-
* // returns 13000.0
71-
*
72-
* im = imag( v );
73-
* // returns -12000.0
53+
* // returns <Complex128>[ 13000.0, -12000.0 ]
7454
*
7555
* v = cceiln( new Complex128( NaN, NaN ), 2 );
76-
* // returns <Complex128>
77-
*
78-
* re = real( v );
79-
* // returns NaN
80-
*
81-
* im = imag( v );
82-
* // returns NaN
56+
* // returns <Complex128>[ NaN, NaN ]
8357
*/
8458
function cceiln( z, n ) {
8559
var v = addon( z, n );

0 commit comments

Comments
 (0)