Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 5 additions & 39 deletions lib/node_modules/@stdlib/math/base/special/croundn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,44 +36,18 @@ Rounds each component of a double-precision complex floating-point number to the

```javascript
var Complex128 = require( '@stdlib/complex/float64/ctor' );
var real = require( '@stdlib/complex/float64/real' );
var imag = require( '@stdlib/complex/float64/imag' );

var v = croundn( new Complex128( -3.141592653589793, 3.141592653589793 ), -2 );
// returns <Complex128>

var re = real( v );
// returns -3.14

var im = imag( v );
// returns 3.14
// returns <Complex128>[ -3.14, 3.14 ]

v = croundn( new Complex128( -3.141592653589793, 3.141592653589793 ), 0 );
// returns <Complex128>

re = real( v );
// returns -3.0

im = imag( v );
// returns 3.0
// returns <Complex128>[ -3.0, 3.0 ]

v = croundn( new Complex128( -12368.0, 12368.0 ), 3 );
// returns <Complex128>

re = real( v );
// returns -12000.0

im = imag( v );
// returns 12000.0
// returns <Complex128>[ -12000.0, 12000.0 ]

v = croundn( new Complex128( NaN, NaN ), 3 );
// returns <Complex128>

re = real( v );
// returns NaN

im = imag( v );
// returns NaN
// returns <Complex128>[ NaN, NaN ]
```

</section>
Expand All @@ -88,21 +62,13 @@ im = imag( v );

```javascript
var Complex128 = require( '@stdlib/complex/float64/ctor' );
var real = require( '@stdlib/complex/float64/real' );
var imag = require( '@stdlib/complex/float64/imag' );

var x = 0.2 + 0.1;
// returns 0.30000000000000004

// Should round components to 0.3:
var v = croundn( new Complex128( x, x ), -16 );
// returns <Complex128>

var re = real( v );
// returns 0.3000000000000001

var im = imag( v );
// returns 0.3000000000000001
// returns <Complex128>[ 0.3000000000000001, 0.3000000000000001 ]
```

</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@
Examples
--------
> var v = {{alias}}( new {{alias:@stdlib/complex/float64/ctor}}( 5.555, -3.336 ), -2 )
<Complex128>
> var re = {{alias:@stdlib/complex/float64/real}}( v )
5.56
> var im = {{alias:@stdlib/complex/float64/imag}}( v )
-3.34
<Complex128>[ 5.56, -3.34 ]

See Also
--------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,9 @@ import { Complex128 } from '@stdlib/types/complex';
*
* @example
* var Complex128 = require( '@stdlib/complex/float64/ctor' );
* var real = require( '@stdlib/complex/float64/real' );
* var imag = require( '@stdlib/complex/float64/imag' );
*
* var v = croundn( new Complex128( 5.555, -3.333 ), -2 );
* // returns <Complex128>
*
* var re = real( v );
* // returns 5.56
*
* var im = imag( v );
* // returns -3.33
* // returns <Complex128>[ 5.56, -3.33 ]
*/
declare function croundn( z: Complex128, n: number ): Complex128;

Expand Down
34 changes: 4 additions & 30 deletions lib/node_modules/@stdlib/math/base/special/croundn/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,47 +25,21 @@
*
* @example
* var Complex128 = require( '@stdlib/complex/float64/ctor' );
* var real = require( '@stdlib/complex/float64/real' );
* var imag = require( '@stdlib/complex/float64/imag' );
* var croundn = require( '@stdlib/math/base/special/croundn' );
*
* var v = croundn( new Complex128( -3.141592653589793, 3.141592653589793 ), -2 );
* // returns <Complex128>
*
* var re = real( v );
* // returns -3.14
*
* var im = imag( v );
* // returns 3.14
* // returns <Complex128>[ -3.14, 3.14 ]
*
* // If n = 0, `croundn` behaves like `cround`:
* v = croundn( new Complex128( 9.99999, 0.1 ), 0 );
* // returns <Complex128>
*
* re = real( v );
* // returns 10.0
*
* im = imag( v );
* // returns 0.0
* // returns <Complex128>[ 10.0, 0.0 ]
*
* // Round components to the nearest thousand:
* v = croundn( new Complex128( 12368.0, -12368.0 ), 3 );
* // returns <Complex128>
*
* re = real( v );
* // returns 12000.0
*
* im = imag( v );
* // returns -12000.0
* // returns <Complex128>[ 12000.0, -12000.0 ]
*
* v = croundn( new Complex128( NaN, NaN ), 2 );
* // returns <Complex128>
*
* re = real( v );
* // returns NaN
*
* im = imag( v );
* // returns NaN
* // returns <Complex128>[ NaN, NaN ]
*/

// MODULES //
Expand Down
34 changes: 4 additions & 30 deletions lib/node_modules/@stdlib/math/base/special/croundn/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,46 +37,20 @@ var imag = require( '@stdlib/complex/float64/imag' );
*
* @example
* var Complex128 = require( '@stdlib/complex/float64/ctor' );
* var real = require( '@stdlib/complex/float64/real' );
* var imag = require( '@stdlib/complex/float64/imag' );
*
* var v = croundn( new Complex128( -3.141592653589793, 3.141592653589793 ), -2 );
* // returns <Complex128>
*
* var re = real( v );
* // returns -3.14
*
* var im = imag( v );
* // returns 3.14
* // returns <Complex128>[ -3.14, 3.14 ]
*
* // If n = 0, `croundn` behaves like `cround`:
* v = croundn( new Complex128( 9.99999, 0.1 ), 0 );
* // returns <Complex128>
*
* re = real( v );
* // returns 10.0
*
* im = imag( v );
* // returns 0.0
* // returns <Complex128>[ 10.0, 0.0 ]
*
* // Round components to the nearest thousand:
* v = croundn( new Complex128( 12368.0, -12368.0 ), 3 );
* // returns <Complex128>
*
* re = real( v );
* // returns 12000.0
*
* im = imag( v );
* // returns -12000.0
* // returns <Complex128>[ 12000.0, -12000.0 ]
*
* v = croundn( new Complex128( NaN, NaN ), 2 );
* // returns <Complex128>
*
* re = real( v );
* // returns NaN
*
* im = imag( v );
* // returns NaN
* // returns <Complex128>[ NaN, NaN ]
*/
function croundn( z, n ) {
return new Complex128( roundn( real( z ), n ), roundn( imag( z ), n ) );
Expand Down
34 changes: 4 additions & 30 deletions lib/node_modules/@stdlib/math/base/special/croundn/lib/native.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,46 +36,20 @@ var addon = require( './../src/addon.node' );
*
* @example
* var Complex128 = require( '@stdlib/complex/float64/ctor' );
* var real = require( '@stdlib/complex/float64/real' );
* var imag = require( '@stdlib/complex/float64/imag' );
*
* var v = croundn( new Complex128( -3.141592653589793, 3.141592653589793 ), -2 );
* // returns <Complex128>
*
* var re = real( v );
* // returns -3.14
*
* var im = imag( v );
* // returns 3.14
* // returns <Complex128>[ -3.14, 3.14 ]
*
* // If n = 0, `croundn` behaves like `cround`:
* v = croundn( new Complex128( 9.99999, 0.1 ), 0 );
* // returns <Complex128>
*
* re = real( v );
* // returns 10.0
*
* im = imag( v );
* // returns 0.0
* // returns <Complex128>[ 10.0, 0.0 ]
*
* // Round components to the nearest thousand:
* v = croundn( new Complex128( 12368.0, -12368.0 ), 3 );
* // returns <Complex128>
*
* re = real( v );
* // returns 12000.0
*
* im = imag( v );
* // returns -12000.0
* // returns <Complex128>[ 12000.0, -12000.0 ]
*
* v = croundn( new Complex128( NaN, NaN ), 2 );
* // returns <Complex128>
*
* re = real( v );
* // returns NaN
*
* im = imag( v );
* // returns NaN
* // returns <Complex128>[ NaN, NaN ]
*/
function croundn( z, n ) {
var v = addon( z, n );
Expand Down