time-to-botec

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

README.md (4373B)


      1 <!--
      2 
      3 @license Apache-2.0
      4 
      5 Copyright (c) 2020 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 # iterAcoth
     22 
     23 > Create an [iterator][mdn-iterator-protocol] which iteratively computes the [inverse hyperbolic cotangent][@stdlib/math/base/special/acoth].
     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 iterAcoth = require( '@stdlib/math/iter/special/acoth' );
     41 ```
     42 
     43 #### iterAcoth( iterator )
     44 
     45 Returns an [iterator][mdn-iterator-protocol] which iteratively computes the [inverse hyperbolic cotangent][@stdlib/math/base/special/acoth].
     46 
     47 ```javascript
     48 var array2iterator = require( '@stdlib/array/to-iterator' );
     49 
     50 var it = iterAcoth( array2iterator( [ 2.0, 1.0 ] ) );
     51 // returns <Object>
     52 
     53 var r = it.next().value;
     54 // returns ~0.5493
     55 
     56 r = it.next().value;
     57 // returns Infinity
     58 
     59 // ...
     60 ```
     61 
     62 The returned [iterator][mdn-iterator-protocol] protocol-compliant object has the following properties:
     63 
     64 -   **next**: function which returns an [iterator][mdn-iterator-protocol] protocol-compliant object containing the next iterated value (if one exists) assigned to a `value` property and a `done` property having a `boolean` value indicating whether the iterator is finished.
     65 -   **return**: function which closes an [iterator][mdn-iterator-protocol] and returns a single (optional) argument in an [iterator][mdn-iterator-protocol] protocol-compliant object.
     66 
     67 </section>
     68 
     69 <!-- /.usage -->
     70 
     71 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
     72 
     73 <section class="notes">
     74 
     75 ## Notes
     76 
     77 -   The domain of inverse hyperbolic cotangent is restricted to `(-inf,-1]` and `[1,inf)`. If an iterated value is outside of the domain, the returned [iterator][mdn-iterator-protocol] returns `NaN`.
     78 -   If an iterated value is non-numeric (including `NaN`), the returned [iterator][mdn-iterator-protocol] returns `NaN`. If non-numeric iterated values are possible, you are advised to provide an [`iterator`][mdn-iterator-protocol] which type checks and handles non-numeric values accordingly.
     79 -   If an environment supports `Symbol.iterator` **and** a provided [iterator][mdn-iterator-protocol] is iterable, the returned [iterator][mdn-iterator-protocol] is iterable.
     80 
     81 </section>
     82 
     83 <!-- /.notes -->
     84 
     85 <!-- Package usage examples. -->
     86 
     87 <section class="examples">
     88 
     89 ## Examples
     90 
     91 <!-- eslint no-undef: "error" -->
     92 
     93 ```javascript
     94 var uniform = require( '@stdlib/random/iter/uniform' );
     95 var iterAcoth = require( '@stdlib/math/iter/special/acoth' );
     96 
     97 // Create a seeded iterator for generating pseudorandom numbers:
     98 var rand = uniform( 1.0, 10.0, {
     99     'seed': 1234,
    100     'iter': 10
    101 });
    102 
    103 // Create an iterator which consumes the pseudorandom number iterator:
    104 var it = iterAcoth( rand );
    105 
    106 // Perform manual iteration...
    107 var r;
    108 while ( true ) {
    109     r = it.next();
    110     if ( r.done ) {
    111         break;
    112     }
    113     console.log( r.value );
    114 }
    115 ```
    116 
    117 </section>
    118 
    119 <!-- /.examples -->
    120 
    121 <!-- 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. -->
    122 
    123 <section class="references">
    124 
    125 </section>
    126 
    127 <!-- /.references -->
    128 
    129 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    130 
    131 <section class="links">
    132 
    133 [mdn-iterator-protocol]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterator_protocol
    134 
    135 [@stdlib/math/base/special/acoth]: https://www.npmjs.com/package/@stdlib/math/tree/main/base/special/acoth
    136 
    137 </section>
    138 
    139 <!-- /.links -->