Skip to content

Commit a0afa69

Browse files
feat: docs added
1 parent 12e33ae commit a0afa69

File tree

5 files changed

+162
-3
lines changed

5 files changed

+162
-3
lines changed

lib/node_modules/@stdlib/math/base/special/atan2/test/fixtures/julia/REQUIRE

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
{{alias}}( y, x )
3+
Computes the angle in the plane (in radians) between the positive x-axis and
4+
the ray from (0,0) to the point (x,y).
5+
6+
Parameters
7+
----------
8+
y: number
9+
Coordinate along y-axis.
10+
11+
x: number
12+
Coordinate along x-axis.
13+
14+
Returns
15+
-------
16+
out: number
17+
Angle (in radians).
18+
19+
Examples
20+
--------
21+
> var v = {{alias}}( 2.0f, 2.0f )
22+
~0.785f
23+
> v = {{alias}}( 6.0f, 2.0f )
24+
~1.249f
25+
> v = {{alias}}( -1.0f, -1.0f )
26+
~-2.356f
27+
> v = {{alias}}( 3.0f, 0.0f )
28+
~1.571f
29+
> v = {{alias}}( -2.0f, 0.0f )
30+
~-1.571f
31+
> v = {{alias}}( 0.0f, 0.0f )
32+
0.0f
33+
> v = {{alias}}( 3.0f, NaN )
34+
NaN
35+
> v = {{alias}}( NaN, 2.0f )
36+
NaN
37+
38+
See Also
39+
--------
40+
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 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+
* Computes the angle in the plane (in radians) between the positive x-axis and the ray from `(0,0)` to the point `(x,y)`.
23+
*
24+
* @param y - `y` coordinate
25+
* @param x - `x` coordinate
26+
* @returns angle (in radians)
27+
*
28+
* @example
29+
* var v = atan2f( 2.0f, 2.0f ); // => atanf(1.0f)
30+
* // returns ~0.785f
31+
*
32+
* @example
33+
* var v = atan2f( 6.0f, 2.0f ); // => atanf(3.0f)
34+
* // returns ~1.249f
35+
*
36+
* @example
37+
* var v = atan2f( -1.0f, -1.0f ); // => atanf(1.0f) - π
38+
* // returns ~-2.356f
39+
*
40+
* @example
41+
* var v = atan2f( 3.0f, 0.0f ); // => π/2
42+
* // returns ~1.571f
43+
*
44+
* @example
45+
* var v = atan2f( -2.0f, 0.0f ); // => -π/2
46+
* // returns ~-1.571f
47+
*
48+
* @example
49+
* var v = atan2f( 0.0f, 0.0f );
50+
* // returns 0.0f
51+
*
52+
* @example
53+
* var v = atan2f( 3.0f, NaN );
54+
* // returns NaN
55+
*
56+
* @example
57+
* var v = atan2( NaN, 2.0f );
58+
* // returns NaN
59+
*/
60+
declare function atan2f( y: number, x: number ): number;
61+
62+
63+
// EXPORTS //
64+
65+
export = atan2f;
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) 2024 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 atan2f = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a number...
25+
{
26+
atan2f( 8, 2 ); // $ExpectType number
27+
}
28+
29+
// The compiler throws an error if the function is provided values other than two numbers...
30+
{
31+
atan2f( true, 3 ); // $ExpectError
32+
atan2f( false, 2 ); // $ExpectError
33+
atan2f( '5', 1 ); // $ExpectError
34+
atan2f( [], 1 ); // $ExpectError
35+
atan2f( {}, 2 ); // $ExpectError
36+
atan2f( ( x: number ): number => x, 2 ); // $ExpectError
37+
38+
atan2f( 9, true ); // $ExpectError
39+
atan2f( 9, false ); // $ExpectError
40+
atan2f( 5, '5' ); // $ExpectError
41+
atan2f( 8, [] ); // $ExpectError
42+
atan2f( 9, {} ); // $ExpectError
43+
atan2f( 8, ( x: number ): number => x ); // $ExpectError
44+
45+
atan2f( [], true ); // $ExpectError
46+
atan2f( {}, false ); // $ExpectError
47+
atan2f( false, '5' ); // $ExpectError
48+
atan2f( {}, [] ); // $ExpectError
49+
atan2f( '5', ( x: number ): number => x ); // $ExpectError
50+
}
51+
52+
// The compiler throws an error if the function is provided insufficient arguments...
53+
{
54+
atan2(); // $ExpectError
55+
atan2( 3 ); // $ExpectError
56+
}

lib/node_modules/@stdlib/math/base/special/atan2f/test/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,4 +221,4 @@ tape( 'the function evaluates the `atan2` function (when x and y are negative)',
221221
t.equal( delta <= tol, true, 'within tolerance. y: '+y[i]+'. x: '+x[i]+'. Actual: '+actual+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' );
222222
}
223223
t.end();
224-
});
224+
});

0 commit comments

Comments
 (0)