Skip to content

Commit 98232f7

Browse files
committed
fix: use hypot and nested max in base implementation
--- 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 3aa564d commit 98232f7

File tree

1 file changed

+9
-8
lines changed
  • lib/node_modules/@stdlib/lapack/base/dlartg/lib

1 file changed

+9
-8
lines changed

lib/node_modules/@stdlib/lapack/base/dlartg/lib/base.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323
var dlamch = require( '@stdlib/lapack/base/dlamch' );
2424
var sqrt = require( '@stdlib/math/base/special/sqrt' );
2525
var abs = require( '@stdlib/math/base/special/fast/abs' );
26-
var sign = require( '@stdlib/math/base/special/copysign' );
26+
var hypot = require( '@stdlib/math/base/special/fast/hypot' );
27+
var copysign = require( '@stdlib/math/base/special/copysign' );
2728
var min = require( '@stdlib/math/base/special/fast/min' );
28-
var max = require( '@stdlib/math/base/special/maxn' );
29+
var max = require( '@stdlib/math/base/special/fast/max' );
2930

3031

3132
// VARIABLES //
@@ -91,20 +92,20 @@ function dlartg( F, offsetF, G, offsetG, C, offsetC, S, offsetS, R, offsetR ) {
9192
R[ offsetR ] = F[ offsetF ];
9293
} else if ( F[ offsetF ] === 0.0 ) {
9394
C[ offsetC ] = 0.0;
94-
S[ offsetS ] = sign( 1.0, G[ offsetG ] );
95+
S[ offsetS ] = copysign( 1.0, G[ offsetG ] );
9596
R[ offsetR ] = g1;
9697
} else if ( f1 > rtmin && f1 < rtmax && g1 > rtmin && g1 < rtmax ) {
97-
d = sqrt( (F[ offsetF ]*F[ offsetF ]) + (G[ offsetG ]*G[ offsetG ]) );
98+
d = hypot( F[ offsetF ], G[ offsetG ] );
9899
C[ offsetC ] = f1 / d;
99-
R[ offsetR ] = sign( d, F[ offsetF ] );
100+
R[ offsetR ] = copysign( d, F[ offsetF ] );
100101
S[ offsetS ] = G[ offsetG ] / R[ offsetR ];
101102
} else {
102-
u = min( safmax, max( safmin, f1, g1 ) );
103+
u = min( safmax, max( safmin, max( f1, g1 ) ) );
103104
fs = F[ offsetF ] / u;
104105
gs = G[ offsetG ] / u;
105-
d = sqrt( (fs*fs) + (gs*gs) );
106+
d = hypot( fs, gs );
106107
C[ offsetC ] = abs( fs ) / d;
107-
R[ offsetR ] = sign( d, F[ offsetF ] );
108+
R[ offsetR ] = copysign( d, F[ offsetF ] );
108109
S[ offsetS ] = gs / R[ offsetR ];
109110
R[ offsetR ] *= u;
110111
}

0 commit comments

Comments
 (0)