time-to-botec

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

README.md (3162B)


      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 # maxabs
     22 
     23 > Return the maximum absolute value.
     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 maxabs = require( '@stdlib/math/base/special/maxabs' );
     41 ```
     42 
     43 #### maxabs( \[x\[, y\[, ...args]]] )
     44 
     45 Returns the maximum absolute value.
     46 
     47 ```javascript
     48 var v = maxabs( -4.2, 3.14 );
     49 // returns 4.2
     50 
     51 v = maxabs( +0.0, -0.0 );
     52 // returns +0.0
     53 
     54 v = maxabs( 4.2, 3.14, -1.0, 6.8 );
     55 // returns 6.8
     56 ```
     57 
     58 If any argument is `NaN`, the function returns `NaN`.
     59 
     60 ```javascript
     61 var v = maxabs( 4.2, NaN );
     62 // returns NaN
     63 
     64 v = maxabs( NaN, 3.14 );
     65 // returns NaN
     66 ```
     67 
     68 If not provided any arguments, the function returns `+infinity`.
     69 
     70 ```javascript
     71 var v = maxabs();
     72 // returns Infinity
     73 ```
     74 
     75 </section>
     76 
     77 <!-- /.usage -->
     78 
     79 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
     80 
     81 <section class="notes">
     82 
     83 ## Notes
     84 
     85 -   When an empty set is considered a subset of the extended reals (all real numbers, including positive and negative infinity), negative infinity is the least upper bound. Similar to zero being the identity element for the sum of an empty set and to one being the identity element for the product of an empty set, negative infinity is the identity element for the maximum, and thus, `maxabs() = +infinity` (i.e., the absolute value of negative infinity).
     86 
     87 </section>
     88 
     89 <!-- /.notes -->
     90 
     91 <!-- Package usage examples. -->
     92 
     93 <section class="examples">
     94 
     95 ## Examples
     96 
     97 <!-- eslint no-undef: "error" -->
     98 
     99 ```javascript
    100 var randu = require( '@stdlib/random/base/randu' );
    101 var maxabs = require( '@stdlib/math/base/special/maxabs' );
    102 
    103 var x;
    104 var y;
    105 var v;
    106 var i;
    107 
    108 for ( i = 0; i < 100; i++ ) {
    109     x = ( randu()*1000.0 ) - 500.0;
    110     y = ( randu()*1000.0 ) - 500.0;
    111     v = maxabs( x, y );
    112     console.log( 'maxabs(%d,%d) = %d', x, y, v );
    113 }
    114 ```
    115 
    116 </section>
    117 
    118 <!-- /.examples -->
    119 
    120 <!-- 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 
    122 <section class="references">
    123 
    124 </section>
    125 
    126 <!-- /.references -->
    127 
    128 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    129 
    130 <section class="links">
    131 
    132 </section>
    133 
    134 <!-- /.links -->