From a0c1fc412ba52e8a08951c4858e30660f24d2f3f Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sat, 13 Jul 2024 10:55:51 +0530 Subject: [PATCH 1/3] docs: update boost version in math/base/special/digamma --- lib/node_modules/@stdlib/math/base/special/digamma/lib/main.js | 2 +- lib/node_modules/@stdlib/math/base/special/digamma/src/main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/digamma/lib/main.js b/lib/node_modules/@stdlib/math/base/special/digamma/lib/main.js index c847a65e8fc0..8dd7c1d8f52d 100644 --- a/lib/node_modules/@stdlib/math/base/special/digamma/lib/main.js +++ b/lib/node_modules/@stdlib/math/base/special/digamma/lib/main.js @@ -18,7 +18,7 @@ * * ## Notice * -* The original C++ code and copyright notice are from the [Boost library]{@link http://www.boost.org/doc/libs/1_53_0/libs/math/doc/sf_and_dist/html/math_toolkit/special/sf_gamma/digamma.html}. The implementation follows the original but has been modified for JavaScript. +* The original C++ code and copyright notice are from the [Boost library]{@link https://www.boost.org/doc/libs/1_85_0/boost/math/special_functions/digamma.hpp}. The implementation follows the original but has been modified for JavaScript. * * ```text * (C) Copyright John Maddock 2006. diff --git a/lib/node_modules/@stdlib/math/base/special/digamma/src/main.c b/lib/node_modules/@stdlib/math/base/special/digamma/src/main.c index bd1ed84759f6..54049b38d317 100644 --- a/lib/node_modules/@stdlib/math/base/special/digamma/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/digamma/src/main.c @@ -18,7 +18,7 @@ * * ## Notice * -* The original C++ code and copyright notice are from the [Boost library]{@link http://www.boost.org/doc/libs/1_53_0/libs/math/doc/sf_and_dist/html/math_toolkit/special/sf_gamma/digamma.html}. The implementation follows the original but has been modified for JavaScript. +* The original C++ code and copyright notice are from the [Boost library]{@link https://www.boost.org/doc/libs/1_85_0/boost/math/special_functions/digamma.hpp}. The implementation follows the original but has been modified for JavaScript. * * ```text * (C) Copyright John Maddock 2006. From 2b9a7bcfabd4cb809b4b4041ead9b0a817dc0084 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sat, 13 Jul 2024 10:58:46 +0530 Subject: [PATCH 2/3] Revert "docs: update boost version in math/base/special/digamma" This reverts commit a0c1fc412ba52e8a08951c4858e30660f24d2f3f. --- lib/node_modules/@stdlib/math/base/special/digamma/lib/main.js | 2 +- lib/node_modules/@stdlib/math/base/special/digamma/src/main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/digamma/lib/main.js b/lib/node_modules/@stdlib/math/base/special/digamma/lib/main.js index 8dd7c1d8f52d..c847a65e8fc0 100644 --- a/lib/node_modules/@stdlib/math/base/special/digamma/lib/main.js +++ b/lib/node_modules/@stdlib/math/base/special/digamma/lib/main.js @@ -18,7 +18,7 @@ * * ## Notice * -* The original C++ code and copyright notice are from the [Boost library]{@link https://www.boost.org/doc/libs/1_85_0/boost/math/special_functions/digamma.hpp}. The implementation follows the original but has been modified for JavaScript. +* The original C++ code and copyright notice are from the [Boost library]{@link http://www.boost.org/doc/libs/1_53_0/libs/math/doc/sf_and_dist/html/math_toolkit/special/sf_gamma/digamma.html}. The implementation follows the original but has been modified for JavaScript. * * ```text * (C) Copyright John Maddock 2006. diff --git a/lib/node_modules/@stdlib/math/base/special/digamma/src/main.c b/lib/node_modules/@stdlib/math/base/special/digamma/src/main.c index 54049b38d317..bd1ed84759f6 100644 --- a/lib/node_modules/@stdlib/math/base/special/digamma/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/digamma/src/main.c @@ -18,7 +18,7 @@ * * ## Notice * -* The original C++ code and copyright notice are from the [Boost library]{@link https://www.boost.org/doc/libs/1_85_0/boost/math/special_functions/digamma.hpp}. The implementation follows the original but has been modified for JavaScript. +* The original C++ code and copyright notice are from the [Boost library]{@link http://www.boost.org/doc/libs/1_53_0/libs/math/doc/sf_and_dist/html/math_toolkit/special/sf_gamma/digamma.html}. The implementation follows the original but has been modified for JavaScript. * * ```text * (C) Copyright John Maddock 2006. From 7381c86edcad8f10f04b15211e73d8dfe906c8a3 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 15 Jul 2024 13:52:27 +0530 Subject: [PATCH 3/3] feat: add C implementation for math/base/special/floorsd --- .../math/base/special/floorsd/README.md | 74 +++++++ .../floorsd/benchmark/benchmark.native.js | 60 ++++++ .../floorsd/benchmark/c/native/Makefile | 146 +++++++++++++ .../floorsd/benchmark/c/native/benchmark.c | 136 +++++++++++++ .../math/base/special/floorsd/binding.gyp | 170 ++++++++++++++++ .../base/special/floorsd/examples/c/Makefile | 146 +++++++++++++ .../base/special/floorsd/examples/c/example.c | 34 ++++ .../math/base/special/floorsd/include.gypi | 53 +++++ .../stdlib/math/base/special/floorsd.h | 40 ++++ .../math/base/special/floorsd/lib/native.js | 60 ++++++ .../math/base/special/floorsd/manifest.json | 93 +++++++++ .../math/base/special/floorsd/src/Makefile | 70 +++++++ .../math/base/special/floorsd/src/addon.c | 23 +++ .../math/base/special/floorsd/src/main.c | 82 ++++++++ .../base/special/floorsd/test/test.native.js | 192 ++++++++++++++++++ 15 files changed, 1379 insertions(+) create mode 100644 lib/node_modules/@stdlib/math/base/special/floorsd/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/math/base/special/floorsd/benchmark/c/native/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/floorsd/benchmark/c/native/benchmark.c create mode 100644 lib/node_modules/@stdlib/math/base/special/floorsd/binding.gyp create mode 100644 lib/node_modules/@stdlib/math/base/special/floorsd/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/floorsd/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/math/base/special/floorsd/include.gypi create mode 100644 lib/node_modules/@stdlib/math/base/special/floorsd/include/stdlib/math/base/special/floorsd.h create mode 100644 lib/node_modules/@stdlib/math/base/special/floorsd/lib/native.js create mode 100644 lib/node_modules/@stdlib/math/base/special/floorsd/manifest.json create mode 100644 lib/node_modules/@stdlib/math/base/special/floorsd/src/Makefile create mode 100644 lib/node_modules/@stdlib/math/base/special/floorsd/src/addon.c create mode 100644 lib/node_modules/@stdlib/math/base/special/floorsd/src/main.c create mode 100644 lib/node_modules/@stdlib/math/base/special/floorsd/test/test.native.js diff --git a/lib/node_modules/@stdlib/math/base/special/floorsd/README.md b/lib/node_modules/@stdlib/math/base/special/floorsd/README.md index 3d569458c24a..c8b3ed34fac2 100644 --- a/lib/node_modules/@stdlib/math/base/special/floorsd/README.md +++ b/lib/node_modules/@stdlib/math/base/special/floorsd/README.md @@ -87,6 +87,80 @@ for ( i = 0; i < 100; i++ ) { + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/floorsd.h" +``` + +#### stdlib_base_floorsd( x, n, b ) + +Rounds a `numeric` value to the nearest `number` toward negative infinity with `n` significant figures. + +```c +double out = stdlib_base_floorsd( 0.0313, 2, 2 ); +// returns 0.03125 +``` + +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_floorsd( const double x, const int32_t n, const int32_t b ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/floorsd.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_floorsd( x[ i ], n[ i ], b[ i ] ); + printf( "floorsd(%lf, %d, %d) = %lf\n", x[ i ], n[ i ], b[ i ], v ); + } +} +``` + +
+ + + + + + +