Skip to content

Commit 423d843

Browse files
committed
refactor: use powf in frexpf
--- 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: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 4304bee commit 423d843

4 files changed

Lines changed: 19 additions & 19 deletions

File tree

lib/node_modules/@stdlib/math/base/special/frexpf/examples/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
var randu = require( '@stdlib/random/base/randu' );
2222
var roundf = require( '@stdlib/math/base/special/roundf' );
23-
var pow = require( '@stdlib/math/base/special/pow' ); // TODO: replace with `powf` when available
23+
var powf = require( '@stdlib/math/base/special/powf' );
2424
var f32 = require( '@stdlib/number/float64/base/to-float32' );
2525
var BIAS = require( '@stdlib/constants/float32/exponent-bias' );
2626
var frexpf = require( './../lib' );
@@ -42,12 +42,12 @@ for ( i = 0; i < 100; i++ ) {
4242
}
4343
frac = f32( randu()*10.0 );
4444
exp = roundf( randu()*76.0 ) - 38;
45-
x = f32( sign * frac * f32( pow( 10.0, exp ) ) );
45+
x = f32( sign * frac * f32( powf( 10.0, exp ) ) );
4646
f = frexpf( x );
4747
if ( f[ 1 ] > BIAS ) {
48-
v = f32( f[ 0 ] * f32( pow(2.0, f[1]-BIAS) ) * f32( pow(2.0, BIAS) ) );
48+
v = f32( f[ 0 ] * f32( powf(2.0, f[1]-BIAS ) ) * f32( powf(2.0, BIAS ) ) );
4949
} else {
50-
v = f32( f[ 0 ] * f32( pow( 2.0, f[ 1 ] ) ) );
50+
v = f32( f[ 0 ] * f32( powf( 2.0, f[ 1 ] ) ) );
5151
}
5252
console.log( '%d = %d * 2^%d = %d', x, f[ 0 ], f[ 1 ], v );
5353
}

lib/node_modules/@stdlib/math/base/special/frexpf/test/test.assign.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var PINF = require( '@stdlib/constants/float32/pinf' );
2626
var BIAS = require( '@stdlib/constants/float32/exponent-bias' );
2727
var randu = require( '@stdlib/random/base/randu' );
2828
var roundf = require( '@stdlib/math/base/special/roundf' );
29-
var pow = require( '@stdlib/math/base/special/pow' ); // TODO: replace with `powf` when available
29+
var powf = require( '@stdlib/math/base/special/powf' );
3030
var absf = require( '@stdlib/math/base/special/absf' );
3131
var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' );
3232
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
@@ -144,15 +144,15 @@ tape( 'the returned normalized fraction and exponent satisfy the relation `x = f
144144
}
145145
frac = f32( randu()*10.0 );
146146
exp = roundf( randu()*76.0 ) - 38;
147-
x = f32( sign * frac * f32( pow( 10.0, exp ) ) );
147+
x = f32( sign * frac * f32( powf( 10.0, exp ) ) );
148148
out = new Float32Array( 2 );
149149
f = frexpf( x, out, 1, 0 );
150150
t.strictEqual( f, out, 'returns output array' );
151151

152152
if ( f[ 1 ] > BIAS ) {
153-
f = f32( f[ 0 ] * pow( 2.0, BIAS ) * pow( 2.0, f[1]-BIAS ) );
153+
f = f32( f[ 0 ] * powf( 2.0, BIAS ) * powf( 2.0, f[1]-BIAS ) );
154154
} else {
155-
f = f32( f[ 0 ] * pow( 2.0, f[ 1 ] ) );
155+
f = f32( f[ 0 ] * powf( 2.0, f[ 1 ] ) );
156156
}
157157
t.strictEqual( f, x, 'returns expected value' );
158158
}
@@ -176,7 +176,7 @@ tape( 'the absolute value of the normalized fraction is on the interval `[1/2,1)
176176
}
177177
frac = f32( randu()*10.0 );
178178
exp = roundf( randu()*74.0 ) - 37;
179-
x = f32( sign * frac * f32( pow( 10.0, exp ) ) );
179+
x = f32( sign * frac * f32( powf( 10.0, exp ) ) );
180180
out = new Float32Array( 2 );
181181
f = frexpf( x, out, 1, 0 );
182182
t.strictEqual( f, out, 'returns output array' );

lib/node_modules/@stdlib/math/base/special/frexpf/test/test.main.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var PINF = require( '@stdlib/constants/float32/pinf' );
2626
var BIAS = require( '@stdlib/constants/float32/exponent-bias' );
2727
var randu = require( '@stdlib/random/base/randu' );
2828
var roundf = require( '@stdlib/math/base/special/roundf' );
29-
var pow = require( '@stdlib/math/base/special/pow' ); // TODO: replace with `powf` when available
29+
var powf = require( '@stdlib/math/base/special/powf' );
3030
var absf = require( '@stdlib/math/base/special/absf' );
3131
var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' );
3232
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
@@ -130,13 +130,13 @@ tape( 'the returned normalized fraction and exponent satisfy the relation `x = f
130130
}
131131
frac = f32( randu()*10.0 );
132132
exp = roundf( randu()*76.0 ) - 38;
133-
x = f32( sign * frac * f32( pow( 10.0, exp ) ) );
133+
x = f32( sign * frac * f32( powf( 10.0, exp ) ) );
134134
f = frexpf( x );
135135

136136
if ( f[ 1 ] > BIAS ) {
137-
f = f32( f[ 0 ] * pow( 2.0, BIAS ) * pow( 2.0, f[1]-BIAS ) );
137+
f = f32( f[ 0 ] * powf( 2.0, BIAS ) * powf( 2.0, f[1]-BIAS ) );
138138
} else {
139-
f = f32( f[ 0 ] * pow( 2.0, f[ 1 ] ) );
139+
f = f32( f[ 0 ] * powf( 2.0, f[ 1 ] ) );
140140
}
141141
t.strictEqual( f, x, 'returns expected value' );
142142
}
@@ -159,7 +159,7 @@ tape( 'the absolute value of the normalized fraction is on the interval `[1/2,1)
159159
}
160160
frac = f32( randu()*10.0 );
161161
exp = roundf( randu()*74.0 ) - 37;
162-
x = f32( sign * frac * f32( pow( 10.0, exp ) ) );
162+
x = f32( sign * frac * f32( powf( 10.0, exp ) ) );
163163
f = frexpf( x );
164164

165165
// Compute the absolute value of the normalized fraction:

lib/node_modules/@stdlib/math/base/special/frexpf/test/test.native.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var PINF = require( '@stdlib/constants/float32/pinf' );
2727
var BIAS = require( '@stdlib/constants/float32/exponent-bias' );
2828
var randu = require( '@stdlib/random/base/randu' );
2929
var roundf = require( '@stdlib/math/base/special/roundf' );
30-
var pow = require( '@stdlib/math/base/special/pow' ); // TODO: replace with `powf` when available
30+
var powf = require( '@stdlib/math/base/special/powf' );
3131
var absf = require( '@stdlib/math/base/special/absf' );
3232
var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' );
3333
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
@@ -139,13 +139,13 @@ tape( 'the returned normalized fraction and exponent satisfy the relation `x = f
139139
}
140140
frac = f32( randu()*10.0 );
141141
exp = roundf( randu()*76.0 ) - 38;
142-
x = f32( sign * frac * f32( pow( 10.0, exp ) ) );
142+
x = f32( sign * frac * f32( powf( 10.0, exp ) ) );
143143
f = frexpf( x );
144144

145145
if ( f[ 1 ] > BIAS ) {
146-
f = f32( f[ 0 ] * pow( 2.0, BIAS ) * pow( 2.0, f[1]-BIAS ) );
146+
f = f32( f[ 0 ] * powf( 2.0, BIAS ) * powf( 2.0, f[1]-BIAS ) );
147147
} else {
148-
f = f32( f[ 0 ] * pow( 2.0, f[ 1 ] ) );
148+
f = f32( f[ 0 ] * powf( 2.0, f[ 1 ] ) );
149149
}
150150
t.strictEqual( f, x, 'returns expected value' );
151151
}
@@ -168,7 +168,7 @@ tape( 'the absolute value of the normalized fraction is on the interval `[1/2,1)
168168
}
169169
frac = f32( randu()*10.0 );
170170
exp = roundf( randu()*74.0 ) - 37;
171-
x = f32( sign * frac * f32( pow( 10.0, exp ) ) );
171+
x = f32( sign * frac * f32( powf( 10.0, exp ) ) );
172172
f = frexpf( x );
173173

174174
// Compute the absolute value of the normalized fraction:

0 commit comments

Comments
 (0)