README.md (1788B)
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 # xlog1py 22 23 > Compute `x * ln(y+1)` so that the result is `0` if `x = 0`. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var xlog1py = require( '@stdlib/math/base/special/xlog1py' ); 31 ``` 32 33 #### xlog1py( x, y ) 34 35 Computes `x * ln(y+1)` so that the result is `0` if `x = 0`. 36 37 ```javascript 38 var out = xlog1py( 3.0, 2.0 ); 39 // returns ~3.296 40 41 out = xlog1py( 1.5, 5.9 ); 42 // returns ~2.897 43 44 out = xlog1py( 0.9, 1.0 ); 45 // returns ~0.624 46 47 out = xlog1py( 1.0, 0.0 ); 48 // returns 0.0 49 50 out = xlog1py( 0.0, -2.0 ); 51 // returns 0.0 52 53 out = xlog1py( 1.5, NaN ); 54 // returns NaN 55 56 out = xlog1py( 0.0, NaN ); 57 // returns NaN 58 59 out = xlog1py( NaN, 2.3 ); 60 // returns NaN 61 ``` 62 63 </section> 64 65 <!-- /.usage --> 66 67 <section class="examples"> 68 69 ## Examples 70 71 <!-- eslint no-undef: "error" --> 72 73 ```javascript 74 var randu = require( '@stdlib/random/base/randu' ); 75 var xlog1py = require( '@stdlib/math/base/special/xlog1py' ); 76 77 var x; 78 var y; 79 var i; 80 81 for ( i = 0; i < 100; i++ ) { 82 x = randu(); 83 if ( x < 0.5 ) { 84 x = 0.0; 85 } 86 y = ( randu() * 20.0 ) - 5.0; 87 console.log( 'xlog1py(%d, %d) = %d', x, y, xlog1py( x, y ) ); 88 } 89 ``` 90 91 </section> 92 93 <!-- /.examples --> 94 95 <section class="links"> 96 97 </section> 98 99 <!-- /.links -->