From 90822adc1180a94339a56ddd18a093095beeebc3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 18 Jul 2024 00:52:54 +0000 Subject: [PATCH] Auto-generated commit --- CHANGELOG.md | 23 ++ base/special/factorial/README.md | 88 +++++++ .../factorial/benchmark/benchmark.native.js | 76 ++++++ .../factorial/benchmark/c/native/Makefile | 146 +++++++++++ .../factorial/benchmark/c/native/benchmark.c | 136 +++++++++++ base/special/factorial/binding.gyp | 170 +++++++++++++ base/special/factorial/examples/c/Makefile | 146 +++++++++++ base/special/factorial/examples/c/example.c | 31 +++ base/special/factorial/include.gypi | 53 ++++ .../stdlib/math/base/special/factorial.h | 40 ++++ base/special/factorial/lib/native.js | 70 ++++++ base/special/factorial/manifest.json | 81 +++++++ base/special/factorial/src/Makefile | 70 ++++++ base/special/factorial/src/addon.c | 23 ++ base/special/factorial/src/main.c | 226 ++++++++++++++++++ base/special/factorial/test/test.native.js | 163 +++++++++++++ 16 files changed, 1542 insertions(+) create mode 100644 base/special/factorial/benchmark/benchmark.native.js create mode 100644 base/special/factorial/benchmark/c/native/Makefile create mode 100644 base/special/factorial/benchmark/c/native/benchmark.c create mode 100644 base/special/factorial/binding.gyp create mode 100644 base/special/factorial/examples/c/Makefile create mode 100644 base/special/factorial/examples/c/example.c create mode 100644 base/special/factorial/include.gypi create mode 100644 base/special/factorial/include/stdlib/math/base/special/factorial.h create mode 100644 base/special/factorial/lib/native.js create mode 100644 base/special/factorial/manifest.json create mode 100644 base/special/factorial/src/Makefile create mode 100644 base/special/factorial/src/addon.c create mode 100644 base/special/factorial/src/main.c create mode 100644 base/special/factorial/test/test.native.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d054fd49..15351e4bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2853,6 +2853,28 @@ This release closes the following issue: +
+ +#### [@stdlib/math/base/special/factorial](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/factorial) + +
+ +
+ +##### Features + +- [`cc98b20`](https://github.com/stdlib-js/stdlib/commit/cc98b20ab91590c526896d547e447f107fc714aa) - add C implementation for `math/base/special/factorial` [(##2618)](#2618 ) + +
+ + + +
+ +
+ + +
#### [@stdlib/math/base/special/factorial2](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/factorial2) @@ -5198,6 +5220,7 @@ A total of 29 people contributed to this release. Thank you to the following con
+- [`cc98b20`](https://github.com/stdlib-js/stdlib/commit/cc98b20ab91590c526896d547e447f107fc714aa) - **feat:** add C implementation for `math/base/special/factorial` [(##2618)](#2618 ) _(by Gunj Joshi)_ - [`1f99cd7`](https://github.com/stdlib-js/stdlib/commit/1f99cd7f06bd5e3027f29c6d816ea39e8624cab1) - **feat:** add C implementation for `math/base/special/floor10` [(##2619)](#2619) _(by Gunj Joshi)_ - [`0d796b2`](https://github.com/stdlib-js/stdlib/commit/0d796b2a86fe0a08d1f3ed1827aaf2ce355f9b4f) - **refactor:** use stdlib APIs and adjust test tolerances _(by Athan Reines)_ - [`d6c4251`](https://github.com/stdlib-js/stdlib/commit/d6c4251492f60d2a3871e679fb67a35c57973056) - **feat:** add C implementation for `math/base/special/sinpi` [(##2610)](#2610) _(by Gunj Joshi)_ diff --git a/base/special/factorial/README.md b/base/special/factorial/README.md index df62c86b6..3b3cec527 100644 --- a/base/special/factorial/README.md +++ b/base/special/factorial/README.md @@ -151,6 +151,94 @@ for ( i = 0; i < x.length; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/factorial.h" +``` + +#### stdlib_base_factorial( x ) + +Evaluates the [factorial][factorial-function] function. + +```c +double out = stdlib_base_factorial( 3.0 ); +// returns 6.0 + +out = stdlib_base_factorial( -1.5 ); +// returns ~-3.545 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. + +```c +double stdlib_base_factorial( const double n ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/factorial.h" +#include + +int main( void ) { + const double x[] = { 2.0, 3.0, 5.0, 8.0 }; + + double y; + int i; + for ( i = 0; i < 4; i++ ) { + y = stdlib_base_factorial( x[ i ] ); + printf( "factorial(%lf) = %lf\n", x[ i ], y ); + } +} +``` + +
+ + + +
+ + +