README.md (2615B)
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 # max 22 23 > Return the maximum 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 max = require( '@stdlib/math/base/special/fast/max' ); 41 ``` 42 43 #### max( x, y ) 44 45 Returns the maximum value. 46 47 ```javascript 48 var v = max( 4.2, 3.14 ); 49 // returns 4.2 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 - The implementation **ignores** the sign of `0`. 63 64 ```javascript 65 var v = max( +0.0, -0.0 ); 66 // returns -0.0 67 68 v = max( -0.0, +0.0 ); 69 // returns +0.0 70 ``` 71 72 - The implementation does **not** check for `NaN` arguments. 73 74 ```javascript 75 var v = max( 3.14, NaN ); 76 // returns NaN 77 78 v = max( NaN, 3.14 ); 79 // returns 3.14 80 ``` 81 82 </section> 83 84 <!-- /.notes --> 85 86 <!-- Package usage examples. --> 87 88 <section class="examples"> 89 90 ## Examples 91 92 <!-- eslint no-undef: "error" --> 93 94 ```javascript 95 var minstd = require( '@stdlib/random/base/minstd-shuffle' ); 96 var max = require( '@stdlib/math/base/special/fast/max' ); 97 98 var x; 99 var y; 100 var v; 101 var i; 102 103 for ( i = 0; i < 100; i++ ) { 104 x = minstd(); 105 y = minstd(); 106 v = max( x, y ); 107 console.log( 'max(%d,%d) = %d', x, y, v ); 108 } 109 ``` 110 111 </section> 112 113 <!-- /.examples --> 114 115 <!-- 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. --> 116 117 <section class="references"> 118 119 </section> 120 121 <!-- /.references --> 122 123 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 124 125 <section class="links"> 126 127 </section> 128 129 <!-- /.links -->