@stdlib/complex-real
Advanced tools
Comparing version 0.0.6 to 0.0.7
{{alias}}( z ) | ||
Returns the real component of a complex number. | ||
Returns the real component of a double-precision complex floating-point | ||
number. | ||
Parameters | ||
---------- | ||
z: Complex | ||
z: Complex128 | ||
Complex number. | ||
@@ -9,0 +10,0 @@ |
@@ -23,6 +23,6 @@ /* | ||
import { ComplexLike } from '@stdlib/types/object'; | ||
import { Complex128 } from '@stdlib/types/object'; | ||
/** | ||
* Returns the real component of a complex number. | ||
* Returns the real component of a double-precision complex floating-point number. | ||
* | ||
@@ -40,3 +40,3 @@ * @param z - complex number | ||
*/ | ||
declare function real( z: ComplexLike ): number; | ||
declare function real( z: Complex128 ): number; | ||
@@ -43,0 +43,0 @@ |
@@ -19,5 +19,4 @@ /* | ||
import Complex128 = require( '@stdlib/complex-float64' ); | ||
import real = require( './index' ); | ||
import Complex128 = require( '@stdlib/complex-float64' ); | ||
import Complex64 = require( '@stdlib/complex-float32' ); | ||
@@ -30,4 +29,2 @@ | ||
real( new Complex128( 5.0, 3.0 ) ); // $ExpectType number | ||
real( new Complex64( 5.0, 3.0 ) ); // $ExpectType number | ||
real( { 're': 5.0, 'im': 3.0 } ); // $ExpectType number | ||
} | ||
@@ -34,0 +31,0 @@ |
@@ -22,3 +22,3 @@ /** | ||
/** | ||
* Return the real component of a complex number. | ||
* Return the real component of a double-precision complex floating-point number. | ||
* | ||
@@ -39,3 +39,3 @@ * @module @stdlib/complex-real | ||
var real = require( './real.js' ); | ||
var main = require( './main.js' ); | ||
@@ -45,2 +45,2 @@ | ||
module.exports = real; | ||
module.exports = main; |
{ | ||
"name": "@stdlib/complex-real", | ||
"version": "0.0.6", | ||
"description": "Return the real component of a complex number.", | ||
"version": "0.0.7", | ||
"description": "Return the real component of a double-precision complex floating-point number.", | ||
"license": "Apache-2.0", | ||
@@ -40,8 +40,8 @@ "author": { | ||
"dependencies": { | ||
"@stdlib/types": "^0.0.x" | ||
"@stdlib/complex-float64": "^0.0.x", | ||
"@stdlib/types": "^0.0.x", | ||
"@stdlib/utils-library-manifest": "^0.0.x" | ||
}, | ||
"devDependencies": { | ||
"@stdlib/bench": "^0.0.x", | ||
"@stdlib/complex-float32": "^0.0.x", | ||
"@stdlib/complex-float64": "^0.0.x", | ||
"@stdlib/math-base-assert-is-nan": "^0.0.x", | ||
@@ -48,0 +48,0 @@ "@stdlib/math-base-special-round": "^0.0.x", |
137
README.md
@@ -23,5 +23,5 @@ <!-- | ||
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url] | ||
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] --> | ||
> Return the real component of a complex number. | ||
> Return the real component of a double-precision complex floating-point number. | ||
@@ -58,3 +58,3 @@ <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> | ||
Returns the **real** component of a `complex` number. | ||
Returns the **real** component of a double-precision complex floating-point number. | ||
@@ -112,2 +112,97 @@ ```javascript | ||
<!-- C interface documentation. --> | ||
* * * | ||
<section class="c"> | ||
## C APIs | ||
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> | ||
<section class="intro"> | ||
</section> | ||
<!-- /.intro --> | ||
<!-- C usage documentation. --> | ||
<section class="usage"> | ||
### Usage | ||
```c | ||
#include "stdlib/complex/real.h" | ||
``` | ||
#### stdlib_real( z ) | ||
Returns the real component of a double-precision complex floating-point number. | ||
```c | ||
#include "stdlib/complex/float64.h" | ||
stdlib_complex128_t z = stdlib_complex128( 5.0, 2.0 ); | ||
// ... | ||
double re = stdlib_real( z ); | ||
// returns 5.0 | ||
``` | ||
The function accepts the following arguments: | ||
- **z**: `[in] stdlib_complex128_t` double-precision complex floating-point number. | ||
```c | ||
double stdlib_real( const stdlib_complex128_t z ); | ||
``` | ||
</section> | ||
<!-- /.usage --> | ||
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> | ||
<section class="notes"> | ||
</section> | ||
<!-- /.notes --> | ||
<!-- C API usage examples. --> | ||
<section class="examples"> | ||
### Examples | ||
```c | ||
#include "stdlib/complex/real.h" | ||
#include "stdlib/complex/float64.h" | ||
#include <stdio.h> | ||
int main() { | ||
stdlib_complex128_t x[] = { | ||
stdlib_complex128( 5.0, 2.0 ), | ||
stdlib_complex128( -2.0, 1.0 ), | ||
stdlib_complex128( 0.0, -0.0 ), | ||
stdlib_complex128( 0.0/0.0, 0.0/0.0 ) | ||
}; | ||
int i; | ||
for ( i = 0; i < 4; i++ ) { | ||
printf( "real(v) = %lf\n", stdlib_real( x[ i ] ) ); | ||
} | ||
} | ||
``` | ||
</section> | ||
<!-- /.examples --> | ||
</section> | ||
<!-- /.c --> | ||
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> | ||
@@ -121,2 +216,17 @@ | ||
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> | ||
<section class="related"> | ||
* * * | ||
## See Also | ||
- <span class="package-name">[`@stdlib/complex/imag`][@stdlib/complex/imag]</span><span class="delimiter">: </span><span class="description">return the imaginary component of a complex number.</span> | ||
- <span class="package-name">[`@stdlib/complex/reim`][@stdlib/complex/reim]</span><span class="delimiter">: </span><span class="description">return the real and imaginary components of a complex number.</span> | ||
</section> | ||
<!-- /.related --> | ||
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> | ||
@@ -148,3 +258,3 @@ | ||
Copyright © 2016-2021. The Stdlib [Authors][stdlib-authors]. | ||
Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. | ||
@@ -168,5 +278,16 @@ </section> | ||
<!-- | ||
[dependencies-image]: https://img.shields.io/david/stdlib-js/complex-real.svg | ||
[dependencies-url]: https://david-dm.org/stdlib-js/complex-real/main | ||
--> | ||
[umd]: https://github.com/umdjs/umd | ||
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules | ||
[deno-url]: https://github.com/stdlib-js/complex-real/tree/deno | ||
[umd-url]: https://github.com/stdlib-js/complex-real/tree/umd | ||
[esm-url]: https://github.com/stdlib-js/complex-real/tree/esm | ||
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg | ||
@@ -181,4 +302,12 @@ [chat-url]: https://gitter.im/stdlib-js/stdlib/ | ||
<!-- <related-links> --> | ||
[@stdlib/complex/imag]: https://www.npmjs.com/package/@stdlib/complex-imag | ||
[@stdlib/complex/reim]: https://www.npmjs.com/package/@stdlib/complex-reim | ||
<!-- </related-links> --> | ||
</section> | ||
<!-- /.links --> |
Sorry, the diff of this file is not supported yet
41142
7
12
189
307
3
+ Added@stdlib/array-float32@0.0.6(transitive)
+ Added@stdlib/assert-has-float32array-support@0.0.8(transitive)
+ Added@stdlib/assert-has-node-buffer-support@0.0.8(transitive)
+ Added@stdlib/assert-has-own-property@0.0.7(transitive)
+ Added@stdlib/assert-has-symbol-support@0.0.8(transitive)
+ Added@stdlib/assert-has-tostringtag-support@0.0.9(transitive)
+ Added@stdlib/assert-is-array@0.0.7(transitive)
+ Added@stdlib/assert-is-boolean@0.0.8(transitive)
+ Added@stdlib/assert-is-buffer@0.0.8(transitive)
+ Added@stdlib/assert-is-float32array@0.0.8(transitive)
+ Added@stdlib/assert-is-function@0.0.8(transitive)
+ Added@stdlib/assert-is-number@0.0.7(transitive)
+ Added@stdlib/assert-is-object@0.0.8(transitive)
+ Added@stdlib/assert-is-object-like@0.0.8(transitive)
+ Added@stdlib/assert-is-plain-object@0.0.7(transitive)
+ Added@stdlib/assert-is-regexp@0.0.7(transitive)
+ Added@stdlib/assert-is-regexp-string@0.0.9(transitive)
+ Added@stdlib/assert-is-string@0.0.8(transitive)
+ Added@stdlib/assert-tools-array-function@0.0.7(transitive)
+ Added@stdlib/buffer-ctor@0.0.7(transitive)
+ Added@stdlib/buffer-from-string@0.0.8(transitive)
+ Added@stdlib/cli-ctor@0.0.3(transitive)
+ Added@stdlib/complex-float32@0.0.7(transitive)
+ Added@stdlib/complex-float64@0.0.8(transitive)
+ Added@stdlib/constants-float64-pinf@0.0.8(transitive)
+ Added@stdlib/fs-exists@0.0.8(transitive)
+ Added@stdlib/fs-read-file@0.0.8(transitive)
+ Added@stdlib/fs-resolve-parent-path@0.0.8(transitive)
+ Added@stdlib/number-ctor@0.0.7(transitive)
+ Added@stdlib/number-float64-base-to-float32@0.0.7(transitive)
+ Added@stdlib/process-cwd@0.0.8(transitive)
+ Added@stdlib/process-read-stdin@0.0.7(transitive)
+ Added@stdlib/regexp-eol@0.0.7(transitive)
+ Added@stdlib/regexp-extended-length-path@0.0.7(transitive)
+ Added@stdlib/regexp-function-name@0.0.7(transitive)
+ Added@stdlib/regexp-regexp@0.0.8(transitive)
+ Added@stdlib/streams-node-stdin@0.0.7(transitive)
+ Added@stdlib/string-base-format-interpolate@0.0.4(transitive)
+ Added@stdlib/string-base-format-tokenize@0.0.4(transitive)
+ Added@stdlib/string-format@0.0.3(transitive)
+ Added@stdlib/string-lowercase@0.0.9(transitive)
+ Added@stdlib/string-replace@0.0.11(transitive)
+ Added@stdlib/utils-constructor-name@0.0.8(transitive)
+ Added@stdlib/utils-convert-path@0.0.8(transitive)
+ Added@stdlib/utils-define-nonenumerable-read-only-property@0.0.7(transitive)
+ Added@stdlib/utils-define-property@0.0.9(transitive)
+ Added@stdlib/utils-escape-regexp-string@0.0.9(transitive)
+ Added@stdlib/utils-get-prototype-of@0.0.7(transitive)
+ Added@stdlib/utils-global@0.0.7(transitive)
+ Added@stdlib/utils-library-manifest@0.0.8(transitive)
+ Added@stdlib/utils-native-class@0.0.8(transitive)
+ Added@stdlib/utils-next-tick@0.0.8(transitive)
+ Added@stdlib/utils-noop@0.0.14(transitive)
+ Added@stdlib/utils-regexp-from-string@0.0.9(transitive)
+ Added@stdlib/utils-type-of@0.0.8(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedis-core-module@2.14.0(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedms@2.0.0(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedresolve@1.22.8(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)