Skip to content

Commit 20368f8

Browse files
committed
feat: docs added
1 parent a10caf2 commit 20368f8

File tree

4 files changed

+174
-0
lines changed

4 files changed

+174
-0
lines changed
Lines changed: 53 additions & 0 deletions
Loading
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
{{alias}}( x )
3+
Computes the inverse half-value versed sine of a single-precision
4+
floating-point number.
5+
6+
The inverse half-value versed sine is defined as `2*asin(sqrt(x))`.
7+
8+
If `x < 0`, `x > 1`, or `x` is `NaN`, the function returns `NaN`.
9+
10+
Parameters
11+
----------
12+
x: number
13+
Input value.
14+
15+
Returns
16+
-------
17+
y: number
18+
Inverse half-value versed sine.
19+
20+
Examples
21+
--------
22+
> var y = {{alias}}( 0.5 )
23+
~1.5708
24+
> y = {{alias}}( 0.0 )
25+
0.0
26+
27+
See Also
28+
--------
29+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2019 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 inverse half-value versed sine of a single-precision floating-point number.
23+
*
24+
* @param x - input value
25+
* @returns inverse half-value versed sine
26+
*
27+
* @example
28+
* var v = ahaversinf( 0.0 );
29+
* // returns 0.0
30+
*
31+
* @example
32+
* var v = ahaversinf( 1.0 );
33+
* // returns ~3.1416
34+
*
35+
* @example
36+
* var v = ahaversinf( 0.5 );
37+
* // returns ~1.5708
38+
*
39+
* @example
40+
* var v = ahaversinf( NaN );
41+
* // returns NaN
42+
*/
43+
declare function ahaversinf( x: number ): number;
44+
45+
46+
// EXPORTS //
47+
48+
export = ahaversinf;
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2019 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 ahaversinf = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a number...
25+
{
26+
ahaversinf( 8 ); // $ExpectType number
27+
}
28+
29+
// The compiler throws an error if the function is provided a value other than a number...
30+
{
31+
ahaversinf( true ); // $ExpectError
32+
ahaversinf( false ); // $ExpectError
33+
ahaversinf( null ); // $ExpectError
34+
ahaversinf( undefined ); // $ExpectError
35+
ahaversinf( '5' ); // $ExpectError
36+
ahaversinf( [] ); // $ExpectError
37+
ahaversinf( {} ); // $ExpectError
38+
ahaversinf( ( x: number ): number => x ); // $ExpectError
39+
}
40+
41+
// The compiler throws an error if the function is provided insufficient arguments...
42+
{
43+
ahaversinf(); // $ExpectError
44+
}

0 commit comments

Comments
 (0)