From 88125d04daf1c41bdc95a7850cf5fba54de908e2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 21 Mar 2024 00:06:42 +0000 Subject: [PATCH] Auto-generated commit --- base/special/gamma-lanczos-sum/README.md | 89 +++++++++ .../benchmark/benchmark.native.js | 60 +++++++ .../benchmark/c/native/Makefile | 146 +++++++++++++++ .../benchmark/c/native/benchmark.c | 136 ++++++++++++++ base/special/gamma-lanczos-sum/binding.gyp | 170 ++++++++++++++++++ .../gamma-lanczos-sum/examples/c/Makefile | 146 +++++++++++++++ .../gamma-lanczos-sum/examples/c/example.c | 31 ++++ base/special/gamma-lanczos-sum/include.gypi | 53 ++++++ .../math/base/special/gamma_lanczos_sum.h | 41 +++++ base/special/gamma-lanczos-sum/lib/native.js | 66 +++++++ .../gamma-lanczos-sum/lib/rational_pq.js | 4 +- base/special/gamma-lanczos-sum/manifest.json | 72 ++++++++ .../gamma-lanczos-sum/scripts/evalrational.js | 48 +++++ base/special/gamma-lanczos-sum/src/Makefile | 70 ++++++++ base/special/gamma-lanczos-sum/src/addon.c | 23 +++ base/special/gamma-lanczos-sum/src/main.c | 74 ++++++++ .../gamma-lanczos-sum/test/test.native.js | 80 +++++++++ 17 files changed, 1307 insertions(+), 2 deletions(-) create mode 100644 base/special/gamma-lanczos-sum/benchmark/benchmark.native.js create mode 100644 base/special/gamma-lanczos-sum/benchmark/c/native/Makefile create mode 100644 base/special/gamma-lanczos-sum/benchmark/c/native/benchmark.c create mode 100644 base/special/gamma-lanczos-sum/binding.gyp create mode 100644 base/special/gamma-lanczos-sum/examples/c/Makefile create mode 100644 base/special/gamma-lanczos-sum/examples/c/example.c create mode 100644 base/special/gamma-lanczos-sum/include.gypi create mode 100644 base/special/gamma-lanczos-sum/include/stdlib/math/base/special/gamma_lanczos_sum.h create mode 100644 base/special/gamma-lanczos-sum/lib/native.js create mode 100644 base/special/gamma-lanczos-sum/manifest.json create mode 100644 base/special/gamma-lanczos-sum/src/Makefile create mode 100644 base/special/gamma-lanczos-sum/src/addon.c create mode 100644 base/special/gamma-lanczos-sum/src/main.c create mode 100644 base/special/gamma-lanczos-sum/test/test.native.js 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 ); + } +} +``` + +
+ + + +
+ + +