diff --git a/base/special/gamma-lanczos-sum/README.md b/base/special/gamma-lanczos-sum/README.md index eabdbe9f1..95841dd90 100644 --- a/base/special/gamma-lanczos-sum/README.md +++ b/base/special/gamma-lanczos-sum/README.md @@ -103,6 +103,95 @@ for ( i = 0; i < x.length; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/gamma_lanczos_sum.h" +``` + +#### gamma_lanczos_sum( x ) + +Calculates the Lanczos sum for the approximation of the [gamma function][gamma-function]. + +```c +double out = gamma_lanczos_sum( 4.0 ); +// returns ~950.366 + +out = gamma_lanczos_sum( -1.5 ); +// returns ~1373366.245 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. + +```c +double gamma_lanczos_sum( const double x ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/gamma_lanczos_sum.h" +#include +#include + +int main( void ) { + const double x[] = { 4.0, -1.5, -0.5, 0.5 }; + + double y; + int i; + for ( i = 0; i < 4; i++ ) { + y = stdlib_base_gamm_lanczos_sum( x[ i ] ); + printf( "gamm_lanczos_sum(%lf) = %lf\n", x[ i ], y ); + } +} +``` + +
+ + + +
+ + +