time-to-botec

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

README.md (2168B)


      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 # Rising Factorial
     22 
     23 > Compute the [rising factorial][falling-and-rising-factorials].
     24 
     25 <section class="intro">
     26 
     27 </section>
     28 
     29 <!-- /.intro -->
     30 
     31 <section class="usage">
     32 
     33 ## Usage
     34 
     35 ```javascript
     36 var risingFactorial = require( '@stdlib/math/base/special/rising-factorial' );
     37 ```
     38 
     39 #### risingFactorial( x, n )
     40 
     41 Evaluates the [rising factorial][falling-and-rising-factorials] of `x` and `n`.
     42 
     43 ```javascript
     44 var v = risingFactorial( 0.9, 5 );
     45 // returns ~94.766
     46 
     47 v = risingFactorial( -9.0, 3 );
     48 // returns -504.0
     49 
     50 v = risingFactorial( 0.0, 2 );
     51 // returns 0.0
     52 
     53 v = risingFactorial( 3.0, -2 );
     54 // returns 0.5
     55 
     56 v = risingFactorial( NaN, 3 );
     57 // returns NaN
     58 
     59 v = risingFactorial( 5.0, NaN );
     60 // returns NaN
     61 
     62 v = risingFactorial( NaN, NaN );
     63 // returns NaN
     64 ```
     65 
     66 The function returns `NaN` for non-integer `n`.
     67 
     68 ```javascript
     69 var v = risingFactorial( 2.0, 1.5 );
     70 // returns NaN
     71 ```
     72 
     73 </section>
     74 
     75 <!-- /.usage -->
     76 
     77 <section class="examples">
     78 
     79 ## Examples
     80 
     81 <!-- eslint no-undef: "error" -->
     82 
     83 ```javascript
     84 var randu = require( '@stdlib/random/base/randu' );
     85 var ceil = require( '@stdlib/math/base/special/ceil' );
     86 var risingFactorial = require( '@stdlib/math/base/special/rising-factorial' );
     87 
     88 var n;
     89 var x;
     90 var i;
     91 
     92 for ( i = 0; i < 100; i++ ) {
     93     x = ( randu()*40.0 ) - 20.0;
     94     n = ceil( ( randu()*40.0 ) - 20.0 );
     95     console.log( 'risingFactorial(%d,%d) = %d', x, n, risingFactorial( x, n ) );
     96 }
     97 ```
     98 
     99 </section>
    100 
    101 <!-- /.examples -->
    102 
    103 <section class="links">
    104 
    105 [falling-and-rising-factorials]: https://en.wikipedia.org/wiki/Falling_and_rising_factorials
    106 
    107 </section>
    108 
    109 <!-- /.links -->