From c837802e791cd86afab637aee0a4baad8de6b5bd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 20 Jul 2024 17:23:46 +0000 Subject: [PATCH] Auto-generated commit --- CHANGELOG.md | 34 ++++ base/special/ceilsd/README.md | 106 ++++++++++- .../ceilsd/benchmark/benchmark.native.js | 60 ++++++ .../ceilsd/benchmark/c/native/Makefile | 146 +++++++++++++++ .../ceilsd/benchmark/c/native/benchmark.c | 136 ++++++++++++++ base/special/ceilsd/binding.gyp | 170 +++++++++++++++++ base/special/ceilsd/docs/repl.txt | 10 +- base/special/ceilsd/docs/types/index.d.ts | 10 +- base/special/ceilsd/docs/types/test.ts | 1 - base/special/ceilsd/examples/c/Makefile | 146 +++++++++++++++ base/special/ceilsd/examples/c/example.c | 34 ++++ base/special/ceilsd/examples/index.js | 2 +- base/special/ceilsd/include.gypi | 53 ++++++ .../include/stdlib/math/base/special/ceilsd.h | 40 ++++ base/special/ceilsd/lib/index.js | 6 +- base/special/ceilsd/lib/main.js | 34 ++-- base/special/ceilsd/lib/native.js | 60 ++++++ base/special/ceilsd/manifest.json | 96 ++++++++++ base/special/ceilsd/src/Makefile | 70 +++++++ base/special/ceilsd/src/addon.c | 23 +++ base/special/ceilsd/src/main.c | 81 +++++++++ base/special/ceilsd/test/test.js | 43 ++--- base/special/ceilsd/test/test.native.js | 171 ++++++++++++++++++ 23 files changed, 1455 insertions(+), 77 deletions(-) create mode 100644 base/special/ceilsd/benchmark/benchmark.native.js create mode 100644 base/special/ceilsd/benchmark/c/native/Makefile create mode 100644 base/special/ceilsd/benchmark/c/native/benchmark.c create mode 100644 base/special/ceilsd/binding.gyp create mode 100644 base/special/ceilsd/examples/c/Makefile create mode 100644 base/special/ceilsd/examples/c/example.c create mode 100644 base/special/ceilsd/include.gypi create mode 100644 base/special/ceilsd/include/stdlib/math/base/special/ceilsd.h create mode 100644 base/special/ceilsd/lib/native.js create mode 100644 base/special/ceilsd/manifest.json create mode 100644 base/special/ceilsd/src/Makefile create mode 100644 base/special/ceilsd/src/addon.c create mode 100644 base/special/ceilsd/src/main.c create mode 100644 base/special/ceilsd/test/test.native.js diff --git a/CHANGELOG.md b/CHANGELOG.md index b23c9ee51..1c67f6e98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2114,6 +2114,38 @@ This release closes the following issue: +
+ +#### [@stdlib/math/base/special/ceilsd](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/ceilsd) + +
+ +
+ +##### Features + +- [`854b793`](https://github.com/stdlib-js/stdlib/commit/854b793ecdcc540067d9989f4c14e34fb9b736bb) - add C implementation for `math/base/special/ceilsd` + +
+ + + +
+ +##### BREAKING CHANGES + +- [`854b793`](https://github.com/stdlib-js/stdlib/commit/854b793ecdcc540067d9989f4c14e34fb9b736bb): add C implementation for `math/base/special/ceilsd` + +
+ + + +
+ +
+ + +
#### [@stdlib/math/base/special/cexp](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/cexp) @@ -5357,6 +5389,7 @@ This release closes the following issue: ### BREAKING CHANGES +- [`854b793`](https://github.com/stdlib-js/stdlib/commit/854b793ecdcc540067d9989f4c14e34fb9b736bb): add C implementation for `math/base/special/ceilsd` - [`bd258a3`](https://github.com/stdlib-js/stdlib/commit/bd258a3c2803d841658c7465505966149845a6fb): update namespace TypeScript declarations - [`bd258a3`](https://github.com/stdlib-js/stdlib/commit/bd258a3c2803d841658c7465505966149845a6fb): update namespace declarations @@ -5463,6 +5496,7 @@ A total of 29 people contributed to this release. Thank you to the following con
+- [`854b793`](https://github.com/stdlib-js/stdlib/commit/854b793ecdcc540067d9989f4c14e34fb9b736bb) - **feat:** add C implementation for `math/base/special/ceilsd` _(by Gunj Joshi, Philipp Burckhardt)_ - [`b063947`](https://github.com/stdlib-js/stdlib/commit/b0639472175808254213fd35d2902e52b998b4cc) - **refactor:** reduce code complexity [(#2632)](https://github.com/stdlib-js/stdlib/pull/2632) _(by Gunj Joshi, Athan Reines)_ - [`bd258a3`](https://github.com/stdlib-js/stdlib/commit/bd258a3c2803d841658c7465505966149845a6fb) - **feat:** update namespace TypeScript declarations [(#2628)](https://github.com/stdlib-js/stdlib/pull/2628) _(by stdlib-bot, Athan Reines)_ - [`607135f`](https://github.com/stdlib-js/stdlib/commit/607135f297a48a24d8d312a61ddfe98a332b1ca5) - **feat:** add C implementation for `math/base/special/ceilb` [(##2627)](#2627) _(by Gunj Joshi)_ diff --git a/base/special/ceilsd/README.md b/base/special/ceilsd/README.md index ca731369a..f75f492e4 100644 --- a/base/special/ceilsd/README.md +++ b/base/special/ceilsd/README.md @@ -30,25 +30,21 @@ limitations under the License. var ceilsd = require( '@stdlib/math/base/special/ceilsd' ); ``` -#### ceilsd( x, n\[, b] ) +#### ceilsd( x, n, b ) Rounds a `numeric` value to the nearest `number` toward positive infinity with `n` significant figures. ```javascript -var v = ceilsd( 3.141592653589793, 5 ); +var v = ceilsd( 3.141592653589793, 5, 10 ); // returns 3.1416 -v = ceilsd( 3.141592653589793, 1 ); +v = ceilsd( 3.141592653589793, 1, 10 ); // returns 4.0 -v = ceilsd( 12368.0, 2 ); +v = ceilsd( 12368.0, 2, 10 ); // returns 13000.0 -``` - -The default base is `10` (decimal). To round using a different base, provide a third argument. -```javascript -var v = ceilsd( 0.0313, 2, 2 ); +v = ceilsd( 0.0313, 2, 2 ); // returns 0.046875 ``` @@ -78,7 +74,7 @@ var i; for ( i = 0; i < 100; i++ ) { x = (randu()*10000.0) - 5000.0; - y = ceilsd( x, 5 ); + y = ceilsd( x, 5, 10 ); console.log( 'x: %d. Rounded: %d.', x, y ); } ``` @@ -87,6 +83,96 @@ for ( i = 0; i < 100; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/ceilsd.h" +``` + +#### stdlib_base_ceilsd( x, n, b ) + +Rounds a `numeric` value to the nearest `number` toward negative infinity with `n` significant figures. + +```c +double out = stdlib_base_ceilsd( 0.0313, 2, 2 ); +// returns 0.046875 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. +- **n**: `[in] int32_t` number of significant figures. +- **b**: `[in] int32_t` base. + +```c +double stdlib_base_ceilsd( const double x, const int32_t n, const int32_t b ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/ceilsd.h" +#include +#include + +int main( void ) { + const double x[] = { -5.0, -3.89, -2.78, -1.67, -0.56, 0.56, 1.67, 2.78, 3.89, 5.0 }; + const int32_t n[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + const int32_t b[] = { 20, 19, 18, 17, 16, 15, 14, 13, 12, 11 }; + + double v; + int i; + for ( i = 0; i < 10; i++ ) { + v = stdlib_base_ceilsd( x[ i ], n[ i ], b[ i ] ); + printf( "ceilsd(%lf, %d, %d) = %lf\n", x[ i ], n[ i ], b[ i ], v ); + } +} +``` + +
+ + + +
+ + +