time-to-botec

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

README.md (2804B)


      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 # hypot
     22 
     23 > Compute the [hypotenuse][hypotenuse].
     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 hypot = require( '@stdlib/math/base/special/fast/hypot' );
     41 ```
     42 
     43 #### hypot( x, y )
     44 
     45 Computes the [hypotenuse][hypotenuse].
     46 
     47 ```javascript
     48 var h = hypot( -5.0, 12.0 );
     49 // returns 13.0
     50 ```
     51 
     52 </section>
     53 
     54 <!-- /.usage -->
     55 
     56 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
     57 
     58 <section class="notes">
     59 
     60 ## Notes
     61 
     62 -   For a sufficiently large `x` and/or `y`, computing the hypotenuse will overflow.
     63 
     64     ```javascript
     65     var h = hypot( 1.0e154, 1.0e154 );
     66     // returns Infinity
     67     ```
     68 
     69     Similarly, for sufficiently small `x` and/or `y`, computing the hypotenuse will underflow.
     70 
     71     ```javascript
     72     var h = hypot( 1e-200, 1.0e-200 );
     73     // returns 0.0
     74     ```
     75 
     76 </section>
     77 
     78 <!-- /.notes -->
     79 
     80 <!-- Package usage examples. -->
     81 
     82 <section class="examples">
     83 
     84 ## Examples
     85 
     86 <!-- eslint no-undef: "error" -->
     87 
     88 ```javascript
     89 var randu = require( '@stdlib/random/base/randu' );
     90 var round = require( '@stdlib/math/base/special/round' );
     91 var hypot = require( '@stdlib/math/base/special/fast/hypot' );
     92 
     93 var x;
     94 var y;
     95 var h;
     96 var i;
     97 
     98 for ( i = 0; i < 100; i++ ) {
     99     x = round( randu()*100.0 ) - 50.0;
    100     y = round( randu()*100.0 ) - 50.0;
    101     h = hypot( x, y );
    102     console.log( 'hypot(%d,%d) = %d', x, y, h );
    103 }
    104 ```
    105 
    106 </section>
    107 
    108 <!-- /.examples -->
    109 
    110 <!-- 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. -->
    111 
    112 <section class="references">
    113 
    114 </section>
    115 
    116 <!-- /.references -->
    117 
    118 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    119 
    120 <section class="links">
    121 
    122 [hypotenuse]: http://en.wikipedia.org/wiki/Pythagorean_theorem
    123 
    124 </section>
    125 
    126 <!-- /.links -->