From d4191ff628e5392d8bfa06a76efe073cb1c7244c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 24 Jul 2024 17:32:06 +0000 Subject: [PATCH] Auto-generated commit --- CHANGELOG.md | 23 +++ base/special/cosm1/README.md | 88 +++++++++ .../cosm1/benchmark/benchmark.native.js | 60 +++++++ .../special/cosm1/benchmark/c/native/Makefile | 146 +++++++++++++++ .../cosm1/benchmark/c/native/benchmark.c | 136 ++++++++++++++ base/special/cosm1/binding.gyp | 170 ++++++++++++++++++ base/special/cosm1/examples/c/Makefile | 146 +++++++++++++++ base/special/cosm1/examples/c/example.c | 31 ++++ base/special/cosm1/include.gypi | 53 ++++++ .../include/stdlib/math/base/special/cosm1.h | 41 +++++ base/special/cosm1/lib/native.js | 62 +++++++ base/special/cosm1/lib/polyval_p.js | 2 +- base/special/cosm1/manifest.json | 72 ++++++++ base/special/cosm1/scripts/evalpoly.js | 48 +++++ base/special/cosm1/src/Makefile | 70 ++++++++ base/special/cosm1/src/addon.c | 22 +++ base/special/cosm1/src/main.c | 79 ++++++++ base/special/cosm1/test/test.js | 8 +- base/special/cosm1/test/test.native.js | 131 ++++++++++++++ 19 files changed, 1383 insertions(+), 5 deletions(-) create mode 100644 base/special/cosm1/benchmark/benchmark.native.js create mode 100644 base/special/cosm1/benchmark/c/native/Makefile create mode 100644 base/special/cosm1/benchmark/c/native/benchmark.c create mode 100644 base/special/cosm1/binding.gyp create mode 100644 base/special/cosm1/examples/c/Makefile create mode 100644 base/special/cosm1/examples/c/example.c create mode 100644 base/special/cosm1/include.gypi create mode 100644 base/special/cosm1/include/stdlib/math/base/special/cosm1.h create mode 100644 base/special/cosm1/lib/native.js create mode 100644 base/special/cosm1/manifest.json create mode 100644 base/special/cosm1/src/Makefile create mode 100644 base/special/cosm1/src/addon.c create mode 100644 base/special/cosm1/src/main.c create mode 100644 base/special/cosm1/test/test.native.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 888cf1196..904d321c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2360,6 +2360,28 @@ This release closes the following issue: +
+ +#### [@stdlib/math/base/special/cosm1](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/cosm1) + +
+ +
+ +##### Features + +- [`143e88d`](https://github.com/stdlib-js/stdlib/commit/143e88d8089ee484eeb54df1d8739f3e146c4cae) - add C implementation for `math/base/special/cosm1` [(##2651)](#2651) + +
+ + + +
+ +
+ + +
#### [@stdlib/math/base/special/cospi](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/cospi) @@ -5516,6 +5538,7 @@ A total of 29 people contributed to this release. Thank you to the following con
+- [`143e88d`](https://github.com/stdlib-js/stdlib/commit/143e88d8089ee484eeb54df1d8739f3e146c4cae) - **feat:** add C implementation for `math/base/special/cosm1` [(##2651)](#2651) _(by Gunj Joshi)_ - [`c77f866`](https://github.com/stdlib-js/stdlib/commit/c77f866c93006ba4bf73221cb28c94c23195ca06) - **feat:** add C implementation for `math/base/special/binet` [(##2653)](#2653) _(by Gunj Joshi)_ - [`9dc29b4`](https://github.com/stdlib-js/stdlib/commit/9dc29b4d2e6eb5ba0b2625c3bfe9f50034a3ed99) - **docs:** add sub-namespace sections and update namespace table of contents _(by Philipp Burckhardt)_ - [`8de8d90`](https://github.com/stdlib-js/stdlib/commit/8de8d90b8a5d72f7c2e57ae21593be5f5f1eb8e7) - **refactor:** perform explicit cast [(#2642)](https://github.com/stdlib-js/stdlib/pull/2642) _(by Gunj Joshi)_ diff --git a/base/special/cosm1/README.md b/base/special/cosm1/README.md index ae442c0b3..c508eb701 100644 --- a/base/special/cosm1/README.md +++ b/base/special/cosm1/README.md @@ -77,6 +77,94 @@ for ( i = 0; i < x.length; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/cosm1.h" +``` + +#### stdlib_base_cosm1( x ) + +Computes `cos(x) - 1`, where `cos` is the [cosine][@stdlib/math/base/special/cos] of a `number` (in radians). This function should be used instead of manually calculating `cos(x) - 1` when the argument is near unity. + +```c +double out = stdlib_base_cosm1( 0.0 ); +// returns 0.0 + +out = stdlib_base_cosm1( 3.141592653589793238 / 4.0 ); +// returns ~-0.293 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. + +```c +double stdlib_base_cosm1( const double x ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/cosm1.h" +#include + +int main( void ) { + const double x[] = { 0.0, 0.523, 0.785, 1.047, 3.14 }; + + double y; + int i; + for ( i = 0; i < 5; i++ ) { + y = stdlib_base_cosm1( x[ i ] ); + printf( "cosm1(%lf) = %lf\n", x[ i ], y ); + } +} +``` + +
+ + + +
+ + +