Skip to content

Commit 3408293

Browse files
refactor: replace pow with stdlib_base_pow
PR-URL: #6369 Reviewed-by: Philipp Burckhardt <[email protected]> Reviewed-by: Gunj Joshi <[email protected]>
1 parent ffeb877 commit 3408293

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
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/main.c

Lines changed: 3 additions & 3 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"
@@ -27,7 +28,6 @@
2728
#include "stdlib/constants/float64/min_base10_exponent_subnormal.h"
2829
#include "stdlib/constants/float64/ninf.h"
2930
#include <stdint.h>
30-
#include <math.h>
3131

3232

3333
// VARIABLES //
@@ -133,14 +133,14 @@ double stdlib_base_floorn( const double x, const int32_t n ) {
133133
}
134134
// 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...
135135
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
136+
s = stdlib_base_pow( 10.0, - ( n + STDLIB_CONSTANT_FLOAT64_MAX_BASE10_EXPONENT ) );
137137
y = ( x * HUGE_VALUE ) * s; // order of operation matters!
138138
if ( stdlib_base_is_infinite( y ) ) {
139139
return x;
140140
}
141141
return ( stdlib_base_floor( y ) / HUGE_VALUE ) / s;
142142
}
143-
s = pow( 10.0, -n ); // TODO: replace use of `pow` once have stdlib equivalent
143+
s = stdlib_base_pow( 10.0, -n );
144144
y = x * s;
145145
if ( stdlib_base_is_infinite( y ) ) {
146146
return x;

0 commit comments

Comments
 (0)