time-to-botec

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

README.md (1725B)


      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 # Natural Logarithm
     22 
     23 > Evaluate the [natural logarithm][natural-logarithm].
     24 
     25 <section class="usage">
     26 
     27 ## Usage
     28 
     29 ```javascript
     30 var ln = require( '@stdlib/math/base/special/ln' );
     31 ```
     32 
     33 #### ln( x )
     34 
     35 Evaluates the [natural logarithm][natural-logarithm].
     36 
     37 ```javascript
     38 var v = ln( 4.0 );
     39 // returns ~1.386
     40 
     41 v = ln( 0.0 );
     42 // returns -Infinity
     43 
     44 v = ln( Infinity );
     45 // returns Infinity
     46 
     47 v = ln( NaN );
     48 // returns NaN
     49 ```
     50 
     51 For negative numbers, the [natural logarithm][natural-logarithm] is **not** defined.
     52 
     53 ```javascript
     54 var v = ln( -4.0 );
     55 // returns NaN
     56 ```
     57 
     58 </section>
     59 
     60 <!-- /.usage -->
     61 
     62 <section class="examples">
     63 
     64 ## Examples
     65 
     66 <!-- eslint no-undef: "error" -->
     67 
     68 ```javascript
     69 var randu = require( '@stdlib/random/base/randu' );
     70 var round = require( '@stdlib/math/base/special/round' );
     71 var ln = require( '@stdlib/math/base/special/ln' );
     72 
     73 var x;
     74 var i;
     75 
     76 for ( i = 0; i < 100; i++ ) {
     77     x = round( randu() * 100.0 );
     78     console.log( 'ln(%d) = %d', x, ln( x ) );
     79 }
     80 ```
     81 
     82 </section>
     83 
     84 <!-- /.examples -->
     85 
     86 <section class="links">
     87 
     88 [natural-logarithm]: https://en.wikipedia.org/wiki/Natural_logarithm
     89 
     90 </section>
     91 
     92 <!-- /.links -->