Skip to content

Commit bb842f6

Browse files
feat: adding initial files
1 parent 29e738e commit bb842f6

8 files changed

Lines changed: 345 additions & 0 deletions

File tree

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2025 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
# FLOAT16_MAX_BASE2_EXPONENT
22+
23+
> The maximum biased base 2 exponent for a [half-precision floating-point number][ieee754].
24+
25+
<section class="usage">
26+
27+
## Usage
28+
29+
<!-- eslint-disable id-length -->
30+
31+
```javascript
32+
var FLOAT16_MAX_BASE2_EXPONENT = require( '@stdlib/constants/float16/max-base2-exponent' );
33+
```
34+
35+
#### FLOAT16_MAX_BASE2_EXPONENT
36+
37+
The maximum biased base 2 exponent for a [half-precision floating-point number][ieee754].
38+
39+
<!-- eslint-disable id-length -->
40+
41+
```javascript
42+
var bool = ( FLOAT16_MAX_BASE2_EXPONENT === 15 );
43+
// returns true
44+
```
45+
46+
</section>
47+
48+
<!-- /.usage -->
49+
50+
<section class="examples">
51+
52+
## Examples
53+
54+
<!-- eslint no-undef: "error" -->
55+
56+
<!-- eslint-disable id-length -->
57+
58+
```javascript
59+
var FLOAT16_MAX_BASE2_EXPONENT = require( '@stdlib/constants/float16/max-base2-exponent' );
60+
61+
console.log( FLOAT16_MAX_BASE2_EXPONENT );
62+
// => 15
63+
```
64+
65+
</section>
66+
67+
<!-- /.examples -->
68+
69+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
70+
71+
<section class="related">
72+
73+
</section>
74+
75+
<!-- /.related -->
76+
77+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
78+
79+
<section class="links">
80+
81+
[ieee754]: https://en.wikipedia.org/wiki/IEEE_754-1985
82+
83+
</section>
84+
85+
<!-- /.links -->
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
{{alias}}
3+
The maximum biased base 2 exponent for a half-precision floating-point
4+
number.
5+
6+
Examples
7+
--------
8+
> {{alias}}
9+
15
10+
11+
See Also
12+
--------
13+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
* The maximum biased base 2 exponent for a half-precision floating-point number.
23+
*
24+
* @example
25+
* var exp = FLOAT16_MAX_BASE2_EXPONENT;
26+
* // returns 15
27+
*/
28+
declare const FLOAT16_MAX_BASE2_EXPONENT: number;
29+
30+
31+
// EXPORTS //
32+
33+
export = FLOAT16_MAX_BASE2_EXPONENT;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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 FLOAT16_MAX_BASE2_EXPONENT = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The export is a number...
25+
{
26+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
27+
FLOAT16_MAX_BASE2_EXPONENT; // $ExpectType number
28+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
'use strict';
20+
21+
var FLOAT16_MAX_BASE2_EXPONENT = require( './../lib' );
22+
23+
console.log( FLOAT16_MAX_BASE2_EXPONENT );
24+
// => 15
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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+
'use strict';
20+
21+
/**
22+
* The maximum biased base 2 exponent for a half-precision floating-point number.
23+
*
24+
* @module @stdlib/constants/float16/max-base2-exponent
25+
* @type {integer32}
26+
*
27+
* @example
28+
* var FLOAT16_MAX_BASE2_EXPONENT = require( '@stdlib/constants/float16/max-base2-exponent' );
29+
* // returns 15
30+
*/
31+
32+
33+
// MAIN //
34+
35+
/**
36+
* The maximum biased base 2 exponent for a half-precision floating-point number.
37+
*
38+
* ```text
39+
* 11110 => 30 - BIAS = 15
40+
* ```
41+
*
42+
* where `BIAS = 15`.
43+
*
44+
* @constant
45+
* @type {integer32}
46+
* @default 15
47+
* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}
48+
*/
49+
var FLOAT16_MAX_BASE2_EXPONENT = 15|0; // asm type annotation
50+
51+
52+
// EXPORTS //
53+
54+
module.exports = FLOAT16_MAX_BASE2_EXPONENT;
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"name": "@stdlib/constants/float16/max-base2-exponent",
3+
"version": "0.0.0",
4+
"description": "The maximum biased base 2 exponent for a half-precision floating-point number.",
5+
"license": "Apache-2.0",
6+
"author": {
7+
"name": "The Stdlib Authors",
8+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
9+
},
10+
"contributors": [
11+
{
12+
"name": "The Stdlib Authors",
13+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
14+
}
15+
],
16+
"main": "./lib",
17+
"directories": {
18+
"doc": "./docs",
19+
"example": "./examples",
20+
"include": "./include",
21+
"lib": "./lib",
22+
"test": "./test"
23+
},
24+
"types": "./docs/types",
25+
"scripts": {},
26+
"homepage": "https://github.com/stdlib-js/stdlib",
27+
"repository": {
28+
"type": "git",
29+
"url": "git://github.com/stdlib-js/stdlib.git"
30+
},
31+
"bugs": {
32+
"url": "https://github.com/stdlib-js/stdlib/issues"
33+
},
34+
"dependencies": {},
35+
"devDependencies": {},
36+
"engines": {
37+
"node": ">=0.10.0",
38+
"npm": ">2.7.0"
39+
},
40+
"os": [
41+
"aix",
42+
"darwin",
43+
"freebsd",
44+
"linux",
45+
"macos",
46+
"openbsd",
47+
"sunos",
48+
"win32",
49+
"windows"
50+
],
51+
"keywords": [
52+
"stdlib",
53+
"stdmath",
54+
"constant",
55+
"const",
56+
"mathematics",
57+
"math",
58+
"half",
59+
"flt",
60+
"floating-point",
61+
"float",
62+
"ieee754",
63+
"bias",
64+
"exponent",
65+
"max",
66+
"maximum",
67+
"binary",
68+
"base 2"
69+
]
70+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
'use strict';
20+
21+
// MODULES //
22+
23+
var tape = require( 'tape' );
24+
var FLOAT16_MAX_BASE2_EXPONENT = require( './../lib' );
25+
26+
27+
// TESTS //
28+
29+
tape( 'main export is a number', function test( t ) {
30+
t.ok( true, __filename );
31+
t.strictEqual( typeof FLOAT16_MAX_BASE2_EXPONENT, 'number', 'main export is a number' );
32+
t.end();
33+
});
34+
35+
tape( 'the exported value is 15', function test( t ) {
36+
t.strictEqual( FLOAT16_MAX_BASE2_EXPONENT, 15, 'returns expected value' );
37+
t.end();
38+
});

0 commit comments

Comments
 (0)