Skip to content

Commit 52f41e5

Browse files
committed
chore: replace pow with stdlib equivalent
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent a77fb9e commit 52f41e5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/node_modules/@stdlib/math/base/special/floorn/manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"@stdlib/math/base/napi/binary",
4242
"@stdlib/math/base/special/abs",
4343
"@stdlib/math/base/special/floor",
44+
"@stdlib/math/base/special/pow",
4445
"@stdlib/math/base/assert/is-infinite",
4546
"@stdlib/math/base/assert/is-nan",
4647
"@stdlib/constants/float64/min-base10-exponent",
@@ -65,6 +66,7 @@
6566
"dependencies": [
6667
"@stdlib/math/base/special/abs",
6768
"@stdlib/math/base/special/floor",
69+
"@stdlib/math/base/special/pow",
6870
"@stdlib/math/base/assert/is-infinite",
6971
"@stdlib/math/base/assert/is-nan",
7072
"@stdlib/constants/float64/min-base10-exponent",
@@ -89,6 +91,7 @@
8991
"dependencies": [
9092
"@stdlib/math/base/special/abs",
9193
"@stdlib/math/base/special/floor",
94+
"@stdlib/math/base/special/pow",
9295
"@stdlib/math/base/assert/is-infinite",
9396
"@stdlib/math/base/assert/is-nan",
9497
"@stdlib/constants/float64/min-base10-exponent",

lib/node_modules/@stdlib/math/base/special/floorn/src/floorn.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "stdlib/math/base/special/floorn.h"
2020
#include "stdlib/math/base/special/abs.h"
2121
#include "stdlib/math/base/special/floor.h"
22+
#include "stdlib/math/base/special/pow.h"
2223
#include "stdlib/math/base/assert/is_infinite.h"
2324
#include "stdlib/math/base/assert/is_nan.h"
2425
#include "stdlib/constants/float64/min_base10_exponent.h"
@@ -133,14 +134,14 @@ double stdlib_base_floorn( const double x, const int32_t n ) {
133134
}
134135
// If we overflow, return `x`, as the number of digits to the right of the decimal is too small (i.e., `x` is too large / lacks sufficient fractional precision) for there to be any effect when rounding...
135136
if ( n < STDLIB_CONSTANT_FLOAT64_MIN_BASE10_EXPONENT ) {
136-
s = pow( 10.0, - ( n + STDLIB_CONSTANT_FLOAT64_MAX_BASE10_EXPONENT ) ); // TODO: replace use of `pow` once have stdlib equivalent
137+
s = stdlib_base_pow( 10.0, - ( n + STDLIB_CONSTANT_FLOAT64_MAX_BASE10_EXPONENT ) );
137138
y = ( x * HUGE_VALUE ) * s; // order of operation matters!
138139
if ( stdlib_base_is_infinite( y ) ) {
139140
return x;
140141
}
141142
return ( stdlib_base_floor( y ) / HUGE_VALUE ) / s;
142143
}
143-
s = pow( 10.0, -n ); // TODO: replace use of `pow` once have stdlib equivalent
144+
s = stdlib_base_pow( 10.0, -n );
144145
y = x * s;
145146
if ( stdlib_base_is_infinite( y ) ) {
146147
return x;

0 commit comments

Comments
 (0)