From 7ae2713aa2b5cf984309760929321677856e3065 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 9 Jun 2024 23:32:47 +0000 Subject: [PATCH] Auto-generated commit --- CHANGELOG.md | 23 + base/special/rempio2/README.md | 104 ++- .../rempio2/benchmark/benchmark.native.js | 63 ++ .../rempio2/benchmark/c/native/Makefile | 146 ++++ .../rempio2/benchmark/c/native/benchmark.c | 138 ++++ base/special/rempio2/binding.gyp | 170 +++++ base/special/rempio2/examples/c/Makefile | 146 ++++ base/special/rempio2/examples/c/example.c | 35 + base/special/rempio2/include.gypi | 53 ++ .../stdlib/math/base/special/rempio2.h | 43 ++ base/special/rempio2/lib/kernel_rempio2.js | 104 ++- base/special/rempio2/lib/native.js | 56 ++ base/special/rempio2/manifest.json | 100 +++ base/special/rempio2/src/Makefile | 70 ++ base/special/rempio2/src/addon.c | 43 ++ base/special/rempio2/src/main.c | 628 ++++++++++++++++++ base/special/rempio2/test/test.js | 90 +-- base/special/rempio2/test/test.native.js | 282 ++++++++ 18 files changed, 2243 insertions(+), 51 deletions(-) create mode 100644 base/special/rempio2/benchmark/benchmark.native.js create mode 100644 base/special/rempio2/benchmark/c/native/Makefile create mode 100644 base/special/rempio2/benchmark/c/native/benchmark.c create mode 100644 base/special/rempio2/binding.gyp create mode 100644 base/special/rempio2/examples/c/Makefile create mode 100644 base/special/rempio2/examples/c/example.c create mode 100644 base/special/rempio2/include.gypi create mode 100644 base/special/rempio2/include/stdlib/math/base/special/rempio2.h create mode 100644 base/special/rempio2/lib/native.js create mode 100644 base/special/rempio2/manifest.json create mode 100644 base/special/rempio2/src/Makefile create mode 100644 base/special/rempio2/src/addon.c create mode 100644 base/special/rempio2/src/main.c create mode 100644 base/special/rempio2/test/test.native.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 881f8ee5e..98d478dd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3774,6 +3774,28 @@ This release closes the following issue: +
+ +#### [@stdlib/math/base/special/rempio2](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/rempio2) + +
+ +
+ +##### Features + +- [`0b633eb`](https://github.com/stdlib-js/stdlib/commit/0b633eb2afe0641b963621048a3ce93795c8d92b) - add C implementation for `math/base/special/rempio2` + +
+ + + +
+ +
+ + +
#### [@stdlib/math/base/special/round](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/round) @@ -4352,6 +4374,7 @@ A total of 24 people contributed to this release. Thank you to the following con
+- [`0b633eb`](https://github.com/stdlib-js/stdlib/commit/0b633eb2afe0641b963621048a3ce93795c8d92b) - **feat:** add C implementation for `math/base/special/rempio2` _(by Gunj Joshi, Philipp Burckhardt, Athan Reines)_ - [`1b5abe6`](https://github.com/stdlib-js/stdlib/commit/1b5abe6cb97ca371aeeae5ef5e39e9ef20898e52) - **chore:** update package meta data [(#2344)](https://github.com/stdlib-js/stdlib/pull/2344) _(by stdlib-bot, Athan Reines)_ - [`e612af5`](https://github.com/stdlib-js/stdlib/commit/e612af58d0e5374e3ed17f0278d2538aec9b37e1) - **docs:** update namespace table of contents [(#2314)](https://github.com/stdlib-js/stdlib/pull/2314) _(by stdlib-bot, Athan Reines)_ - [`95cd4ef`](https://github.com/stdlib-js/stdlib/commit/95cd4ef83e181ffbf50aeef1a6e44e14338d1261) - **docs:** update namespace TypeScript declarations [(#2312)](https://github.com/stdlib-js/stdlib/pull/2312) _(by stdlib-bot, Athan Reines)_ diff --git a/base/special/rempio2/README.md b/base/special/rempio2/README.md index 32551ba1d..978033ba6 100644 --- a/base/special/rempio2/README.md +++ b/base/special/rempio2/README.md @@ -32,7 +32,7 @@ var rempio2 = require( '@stdlib/math/base/special/rempio2' ); #### rempio2( x, y ) -Computes `x - nπ/2 = r`. The function returns `n` and stores the remainder `r` as two numbers in `y`, such that `y[0]+y[1] = r`. +Computes `x - nπ/2 = r`. ```javascript var y = [ 0.0, 0.0 ]; @@ -46,7 +46,7 @@ var y2 = y[ 1 ]; // returns ~3.618e-17 ``` -When `x` is `NaN` or infinite, the function returns zero and sets the elements of `y` to `NaN`. +When `x` is `NaN` or infinite, the function returns `0` and sets the elements of `y` to `NaN`. ```javascript var y = [ 0.0, 0.0 ]; @@ -80,6 +80,7 @@ y2 = y[ 1 ]; ## Notes +- The function returns `n` and stores the remainder `r` as two numbers in `y`, such that `y[0]+y[1] = r`. - For input values larger than `2^20*π/2` in magnitude, the function **only** returns the last three binary digits of `n` and not the full result.
@@ -111,6 +112,105 @@ for ( i = 0; i < x.length; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/rempio2.h" +``` + +#### stdlib_base_rempio2( x, &rem1, &rem2 ) + +Computes `x - nπ/2 = r`. + +```c +#include + +double rem1; +double rem2; + +int32_t n = stdlib_base_rempio2( 4.0, &rem1, &rem2 ); +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. +- **rem1**: `[out] double*` destination for first remainder number. +- **rem2**: `[out] double*` destination for second remainder number. + +```c +int32_t stdlib_base_rempio2( const double x, double *rem1, double *rem2 ); +``` + +
+ + + + + +
+ +### Notes + +- The function returns `n` and stores the remainder `r` as two numbers in `rem1` and `rem2`, respectively, such that `rem1+rem2 = r`. + +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/rempio2.h" +#include +#include +#include + +int main( void ) { + const double x[] = { 0.0, 1.0, 4.0, 128.0 }; + + double rem1; + double rem2; + int32_t n; + int i; + for ( i = 0; i < 4; i++ ) { + n = stdlib_base_rempio2( x[ i ], &rem1, &rem2 ); + printf( "%lf - %"PRId32"π/2 = %lf + %lf\n", x[ i ], n, rem1, rem2 ); + } +} +``` + +
+ + + +
+ + +