Skip to content

Commit d7484a5

Browse files
author
aayush0325
committed
feat: docs added
1 parent db2186b commit d7484a5

File tree

3 files changed

+121
-0
lines changed

3 files changed

+121
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
{{alias}}( x )
3+
Evaluates the base 2 exponential function in
4+
single-precision floating-point format.
5+
6+
Parameters
7+
----------
8+
x: number
9+
Input value.
10+
11+
Returns
12+
-------
13+
y: number
14+
Function value.
15+
16+
Examples
17+
--------
18+
> var y = {{alias}}( 3.0 )
19+
8.0
20+
> y = {{alias}}( -9.0 )
21+
~0.002
22+
> y = {{alias}}( 0.0 )
23+
1.0
24+
> y = {{alias}}( NaN )
25+
NaN
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+
* Evaluates the base 2 exponential function in single-precision floating-point format.
23+
*
24+
* @param x - input value
25+
* @returns function value
26+
*
27+
* @example
28+
* var v = exp2f( 3.0 );
29+
* // returns 8.0
30+
*
31+
* @example
32+
* var v = exp2f( -9.0 );
33+
* // returns ~0.002
34+
*
35+
* @example
36+
* var v = exp2f( 0.0 );
37+
* // returns 1.0
38+
*
39+
* @example
40+
* var v = exp2f( NaN );
41+
* // returns NaN
42+
*/
43+
declare function exp2f( x: number ): number;
44+
45+
46+
// EXPORTS //
47+
48+
export = exp2f;
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 exp2f = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a number...
25+
{
26+
exp2f( 0.5 ); // $ExpectType number
27+
}
28+
29+
// The compiler throws an error if the function is provided a value other than a number...
30+
{
31+
exp2f( true ); // $ExpectError
32+
exp2f( false ); // $ExpectError
33+
exp2f( null ); // $ExpectError
34+
exp2f( undefined ); // $ExpectError
35+
exp2f( '5' ); // $ExpectError
36+
exp2f( [] ); // $ExpectError
37+
exp2f( {} ); // $ExpectError
38+
exp2f( ( x: number ): number => x ); // $ExpectError
39+
}
40+
41+
// The compiler throws an error if the function is provided insufficient arguments...
42+
{
43+
exp2f(); // $ExpectError
44+
}

0 commit comments

Comments
 (0)