Skip to content

Commit a30c06f

Browse files
committed
refactor: use f32 instead of float64ToFloat32
--- 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: passed - 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: 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 9d9b3d2 commit a30c06f

File tree

1 file changed

+19
-21
lines changed
  • lib/node_modules/@stdlib/math/base/special/cinvf/lib

1 file changed

+19
-21
lines changed

lib/node_modules/@stdlib/math/base/special/cinvf/lib/main.js

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@
1616
* limitations under the License.
1717
*/
1818

19-
/* eslint-disable max-len */
20-
2119
'use strict';
2220

2321
// MODULES //
2422

2523
var absf = require( '@stdlib/math/base/special/absf' );
2624
var maxf = require( '@stdlib/math/base/special/maxf' );
27-
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
25+
var f32 = require( '@stdlib/number/float64/base/to-float32' );
2826
var FLOAT32_BIGGEST = require( '@stdlib/constants/float32/max' );
2927
var FLOAT32_SMALLEST = require( '@stdlib/constants/float32/smallest-normal' );
3028
var EPS = require( '@stdlib/constants/float32/eps' );
@@ -35,9 +33,9 @@ var imagf = require( '@stdlib/complex/float32/imag' );
3533

3634
// VARIABLES //
3735

38-
var LARGE_THRESHOLD = FLOAT32_BIGGEST * float64ToFloat32( 0.5 );
39-
var SMALL_THRESHOLD = float64ToFloat32( FLOAT32_SMALLEST*float64ToFloat32( float64ToFloat32(2.0)/EPS ) );
40-
var RECIP_EPS_SQR = float64ToFloat32( float64ToFloat32(2.0) / float64ToFloat32(EPS*EPS) );
36+
var LARGE_THRESHOLD = f32( FLOAT32_BIGGEST * f32( 0.5 ) );
37+
var SMALL_THRESHOLD = f32( FLOAT32_SMALLEST * f32( f32(2.0)/EPS ) );
38+
var RECIP_EPS_SQR = f32( f32(2.0) / f32(EPS*EPS) );
4139

4240

4341
// MAIN //
@@ -77,29 +75,29 @@ function cinvf( z ) {
7775
re = realf( z );
7876
im = imagf( z );
7977
ab = maxf( absf(re), absf(im) );
80-
s = float64ToFloat32( 1.0 );
78+
s = f32( 1.0 );
8179
if ( ab >= LARGE_THRESHOLD ) {
82-
re = float64ToFloat32( re * float64ToFloat32( 0.5 ) );
83-
im = float64ToFloat32( im * float64ToFloat32( 0.5 ) );
84-
s = float64ToFloat32( s * float64ToFloat32( 0.5 ) );
80+
re = f32( re * f32( 0.5 ) );
81+
im = f32( im * f32( 0.5 ) );
82+
s = f32( s * f32( 0.5 ) );
8583
} else if ( ab <= SMALL_THRESHOLD ) {
86-
re = float64ToFloat32( re * RECIP_EPS_SQR );
87-
im = float64ToFloat32( im * RECIP_EPS_SQR );
88-
s = float64ToFloat32( s * RECIP_EPS_SQR );
84+
re = f32( re * RECIP_EPS_SQR );
85+
im = f32( im * RECIP_EPS_SQR );
86+
s = f32( s * RECIP_EPS_SQR );
8987
}
9088
if ( absf( im ) <= absf( re ) ) {
91-
r = float64ToFloat32( im / re );
92-
t = float64ToFloat32( float64ToFloat32( 1.0 ) / float64ToFloat32( re + float64ToFloat32(im*r) ) );
89+
r = f32( im / re );
90+
t = f32( f32( 1.0 ) / f32( re + f32(im*r) ) );
9391
re = t;
94-
im = float64ToFloat32( -r * t );
92+
im = f32( -r * t );
9593
} else {
96-
r = float64ToFloat32( re / im );
97-
t = float64ToFloat32( float64ToFloat32( 1.0 ) / float64ToFloat32( im + float64ToFloat32(re*r) ) );
98-
re = float64ToFloat32( r * t );
94+
r = f32( re / im );
95+
t = f32( f32( 1.0 ) / f32( im + f32(re*r) ) );
96+
re = f32( r * t );
9997
im = -t;
10098
}
101-
re = float64ToFloat32( re * s );
102-
im = float64ToFloat32( im * s );
99+
re = f32( re * s );
100+
im = f32( im * s );
103101
return new Complex64( re, im );
104102
}
105103

0 commit comments

Comments
 (0)