README.md (2002B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # isComplex 22 23 > Test if a value is a [64-bit][@stdlib/complex/float32] or [128-bit][@stdlib/complex/float64] complex number. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var isComplex = require( '@stdlib/assert/is-complex' ); 31 ``` 32 33 #### isComplex( value ) 34 35 Tests if a value is a [64-bit][@stdlib/complex/float32] or [128-bit][@stdlib/complex/float64] complex number. 36 37 ```javascript 38 var Complex128 = require( '@stdlib/complex/float64' ); 39 var Complex64 = require( '@stdlib/complex/float32' ); 40 41 var x = new Complex128( 1.0, 3.0 ); 42 var bool = isComplex( x ); 43 // returns true 44 45 x = new Complex64( 3.0, 1.0 ); 46 bool = isComplex( x ); 47 // returns true 48 ``` 49 50 </section> 51 52 <!-- /.usage --> 53 54 <section class="examples"> 55 56 ## Examples 57 58 <!-- eslint no-undef: "error" --> 59 60 ```javascript 61 var Complex64 = require( '@stdlib/complex/float32' ); 62 var Complex128 = require( '@stdlib/complex/float64' ); 63 var isComplex = require( '@stdlib/assert/is-complex' ); 64 65 var out = isComplex( new Complex64( 2.0, 2.0 ) ); 66 // returns true 67 68 out = isComplex( new Complex128( 3.0, 1.0 ) ); 69 // returns true 70 71 out = isComplex( {} ); 72 // returns false 73 74 out = isComplex( null ); 75 // returns false 76 ``` 77 78 </section> 79 80 <!-- /.examples --> 81 82 <section class="links"> 83 84 [@stdlib/complex/float64]: https://www.npmjs.com/package/@stdlib/complex-float64 85 86 [@stdlib/complex/float32]: https://www.npmjs.com/package/@stdlib/complex-float32 87 88 </section> 89 90 <!-- /.links -->