time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

README.md (3118B)


      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 # Complex Numbers
     22 
     23 > Create a complex number.
     24 
     25 <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
     26 
     27 <section class="intro">
     28 
     29 </section>
     30 
     31 <!-- /.intro -->
     32 
     33 <!-- Package usage documentation. -->
     34 
     35 <section class="usage">
     36 
     37 ## Usage
     38 
     39 ```javascript
     40 var complex = require( '@stdlib/complex/cmplx' );
     41 ```
     42 
     43 #### complex( real, imag\[, dtype] )
     44 
     45 Creates a complex number, where `real` and `imag` are the **real** and **imaginary** components, respectively.
     46 
     47 ```javascript
     48 var z = complex( 5.0, 3.0 );
     49 // returns <Complex128>
     50 ```
     51 
     52 By default, the function returns a [128-bit complex number][@stdlib/complex/float64]. To specify an alternative underlying data type, set the `dtype` parameter to one of the following:
     53 
     54 -   [`'float64'`][@stdlib/complex/float64]: https://www.npmjs.com/package/@stdlib/complex/tree/main/float64
     55 -   [`'float32'`][@stdlib/complex/float32]: https://www.npmjs.com/package/@stdlib/complex/tree/main/float32
     56 
     57 ```javascript
     58 var z = complex( 5.0, 3.0, 'float32' );
     59 // returns <Complex64>
     60 ```
     61 
     62 </section>
     63 
     64 <!-- /.usage -->
     65 
     66 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
     67 
     68 <section class="notes">
     69 
     70 </section>
     71 
     72 <!-- /.notes -->
     73 
     74 <!-- Package usage examples. -->
     75 
     76 <section class="examples">
     77 
     78 ## Examples
     79 
     80 <!-- eslint no-undef: "error" -->
     81 
     82 ```javascript
     83 var randu = require( '@stdlib/random/base/randu' );
     84 var round = require( '@stdlib/math/base/special/round' );
     85 var complex = require( '@stdlib/complex/cmplx' );
     86 
     87 var re;
     88 var im;
     89 var z;
     90 var i;
     91 
     92 for ( i = 0; i < 100; i++ ) {
     93     re = round( (randu()*100.0) - 50.0 );
     94     im = round( (randu()*100.0) - 50.0 );
     95     z = complex( re, im, 'float64' );
     96     console.log( z.toString() );
     97 }
     98 ```
     99 
    100 </section>
    101 
    102 <!-- /.examples -->
    103 
    104 <!-- 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. -->
    105 
    106 <section class="references">
    107 
    108 </section>
    109 
    110 <!-- /.references -->
    111 
    112 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    113 
    114 <section class="links">
    115 
    116 [@stdlib/complex/float64]: https://www.npmjs.com/package/@stdlib/complex/tree/main/float64
    117 
    118 [@stdlib/complex/float32]: https://www.npmjs.com/package/@stdlib/complex/tree/main/float32
    119 
    120 </section>
    121 
    122 <!-- /.links -->