Skip to content

Commit 32864bc

Browse files
committed
docs: add docs fodler
--- 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: passed - 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: 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: passed - task: lint_license_headers status: passed ---
1 parent 6ac3ace commit 32864bc

File tree

3 files changed

+134
-0
lines changed

3 files changed

+134
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
{{alias}}( x, y )
3+
Returns sqrt( x^2 + y^2 ) in a manner which doesn't cause unnecessary
4+
overflow.
5+
6+
If either argument is `NaN` and the other argument is not `+-Infinity`,
7+
the function returns `NaN`.
8+
9+
Parameters
10+
----------
11+
x: number
12+
First number.
13+
14+
y: number
15+
Second number.
16+
17+
Returns
18+
-------
19+
out: number
20+
Sqrt( x^2 + y^2 ).
21+
22+
Examples
23+
--------
24+
> var h = {{alias}}( -5.0, 12.0 )
25+
13.0
26+
> h = {{alias}}( NaN, 12.0 )
27+
NaN
28+
> h = {{alias}}( -0.0, -0.0 )
29+
0.0
30+
31+
See Also
32+
--------
33+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 4.1
20+
21+
/**
22+
* LAPACK routine to calculate sqrt( x^2 + y^2 ) in a manner which doesn't cause unnecessary overflow.
23+
*
24+
* @param x - number
25+
* @param y - number
26+
* @returns sqrt( x^2 + y^2 )
27+
*
28+
* @example
29+
* var h = dlapy2( -5.0, 12.0 );
30+
* // returns 13.0
31+
*
32+
* @example
33+
* var h = dlapy2( NaN, 12.0 );
34+
* // returns NaN
35+
*
36+
* @example
37+
* var h = dlapy2( -0.0, -0.0 );
38+
* // returns 0.0
39+
*/
40+
declare function dlapy2( x: number, y: number ): number;
41+
42+
43+
// EXPORTS //
44+
45+
export = dlapy2;
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import dlapy2 = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a number...
25+
{
26+
dlapy2( 8, 2 ); // $ExpectType number
27+
}
28+
29+
// The compiler throws an error if the function is provided values other than two numbers...
30+
{
31+
dlapy2( true, 3 ); // $ExpectError
32+
dlapy2( false, 2 ); // $ExpectError
33+
dlapy2( '5', 1 ); // $ExpectError
34+
dlapy2( [], 1 ); // $ExpectError
35+
dlapy2( {}, 2 ); // $ExpectError
36+
dlapy2( ( x: number ): number => x, 2 ); // $ExpectError
37+
38+
dlapy2( 9, true ); // $ExpectError
39+
dlapy2( 9, false ); // $ExpectError
40+
dlapy2( 5, '5' ); // $ExpectError
41+
dlapy2( 8, [] ); // $ExpectError
42+
dlapy2( 9, {} ); // $ExpectError
43+
dlapy2( 8, ( x: number ): number => x ); // $ExpectError
44+
45+
dlapy2( [], true ); // $ExpectError
46+
dlapy2( {}, false ); // $ExpectError
47+
dlapy2( false, '5' ); // $ExpectError
48+
dlapy2( {}, [] ); // $ExpectError
49+
dlapy2( '5', ( x: number ): number => x ); // $ExpectError
50+
}
51+
52+
// The compiler throws an error if the function is provided insufficient arguments...
53+
{
54+
dlapy2(); // $ExpectError
55+
dlapy2( 3 ); // $ExpectError
56+
}

0 commit comments

Comments
 (0)