time-to-botec

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

README.md (1708B)


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