Skip to content

Commit 1f49257

Browse files
committed
feat: docs added
1 parent ae2400c commit 1f49257

File tree

4 files changed

+173
-0
lines changed

4 files changed

+173
-0
lines changed
Lines changed: 52 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 cosine of a
4+
single-precision floating-point number.
5+
6+
The inverse half-value versed cosine is defined as `2*acos(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 cosine.
19+
20+
Examples
21+
--------
22+
> var y = {{alias}}( 0.5 )
23+
~1.5708
24+
> y = {{alias}}( 0.0 )
25+
~3.1416
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 cosine of a single-precision floating-point number.
23+
*
24+
* @param x - input value
25+
* @returns inverse half-value versed cosine
26+
*
27+
* @example
28+
* var v = ahavercosf( 0.0 );
29+
* // returns ~3.1416
30+
*
31+
* @example
32+
* var v = ahavercosf( 1.0 );
33+
* // returns 0.0
34+
*
35+
* @example
36+
* var v = ahavercosf( 0.5 );
37+
* // returns ~1.5708
38+
*
39+
* @example
40+
* var v = ahavercosf( NaN );
41+
* // returns NaN
42+
*/
43+
declare function ahavercosf( x: number ): number;
44+
45+
46+
// EXPORTS //
47+
48+
export = ahavercosf;
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 ahavercosf = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a number...
25+
{
26+
ahavercosf( 8 ); // $ExpectType number
27+
}
28+
29+
// The compiler throws an error if the function is provided a value other than a number...
30+
{
31+
ahavercosf( true ); // $ExpectError
32+
ahavercosf( false ); // $ExpectError
33+
ahavercosf( null ); // $ExpectError
34+
ahavercosf( undefined ); // $ExpectError
35+
ahavercosf( '5' ); // $ExpectError
36+
ahavercosf( [] ); // $ExpectError
37+
ahavercosf( {} ); // $ExpectError
38+
ahavercosf( ( x: number ): number => x ); // $ExpectError
39+
}
40+
41+
// The compiler throws an error if the function is provided insufficient arguments...
42+
{
43+
ahavercosf(); // $ExpectError
44+
}

0 commit comments

Comments
 (0)