diff --git a/CHANGELOG.md b/CHANGELOG.md index 6629029fa..b23c9ee51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@
-## Unreleased (2024-07-19) +## Unreleased (2024-07-20)
@@ -5463,6 +5463,7 @@ A total of 29 people contributed to this release. Thank you to the following con
+- [`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)_ - [`d4db8a9`](https://github.com/stdlib-js/stdlib/commit/d4db8a93b0c93cb3392b59ee031ce188399b90a5) - **feat:** add C implementation for `math/base/special/ceil10` [(##2626)](#2626) _(by Gunj Joshi)_ diff --git a/base/special/floorsd/lib/main.js b/base/special/floorsd/lib/main.js index 9189dbe4c..27ed01822 100644 --- a/base/special/floorsd/lib/main.js +++ b/base/special/floorsd/lib/main.js @@ -64,11 +64,7 @@ function floorsd( x, n, b ) { isnan( x ) || isnan( n ) || n < 1 || - isInfinite( n ) - ) { - return NaN; - } - if ( + isInfinite( n ) || isnan( b ) || b <= 0 || isInfinite( b ) diff --git a/base/special/floorsd/src/main.c b/base/special/floorsd/src/main.c index 91d5709bd..7a0ba5fa9 100644 --- a/base/special/floorsd/src/main.c +++ b/base/special/floorsd/src/main.c @@ -40,7 +40,6 @@ * // returns 0.03125 */ double stdlib_base_floorsd( const double x, const int32_t n, const int32_t b ) { - int32_t base; double exp; double s; double y; @@ -48,19 +47,18 @@ double stdlib_base_floorsd( const double x, const int32_t n, const int32_t b ) { if ( stdlib_base_is_nan( x ) || n < 1 || b <= 0 ) { return 0.0 / 0.0; // NaN } - base = b; if ( stdlib_base_is_infinite( x ) || x == 0.0 ) { return x; } - if ( base == 10 ) { + if ( b == 10 ) { exp = stdlib_base_log10( stdlib_base_abs( x ) ); - } else if ( base == 2 ) { + } else if ( b == 2 ) { exp = stdlib_base_float64_exponent( stdlib_base_abs( x ) ); } else { - exp = stdlib_base_ln( stdlib_base_abs( x ) ) / stdlib_base_ln( base ); + exp = stdlib_base_ln( stdlib_base_abs( x ) ) / stdlib_base_ln( (double)b ); } exp = stdlib_base_floor( exp - n + 1.0 ); - s = stdlib_base_pow( base, stdlib_base_abs( exp ) ); + s = stdlib_base_pow( (double)b, stdlib_base_abs( exp ) ); // Check for overflow: if ( stdlib_base_is_infinite( s ) ) {