@stdlib/number-float32-base-exponent 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +1 -1
- package/README.md +5 -5
- package/dist/index.js.map +2 -2
- package/docs/types/index.d.ts +3 -0
- package/include/stdlib/number/float32/base/exponent.h +0 -3
- package/lib/index.js +2 -2
- package/lib/main.js +3 -0
- package/manifest.json +40 -40
- package/package.json +5 -5
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2026 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -242,7 +242,7 @@ See [LICENSE][stdlib-license].
|
|
|
242
242
|
|
|
243
243
|
## Copyright
|
|
244
244
|
|
|
245
|
-
Copyright © 2016-
|
|
245
|
+
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
|
|
246
246
|
|
|
247
247
|
</section>
|
|
248
248
|
|
|
@@ -255,8 +255,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
255
255
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/number-float32-base-exponent.svg
|
|
256
256
|
[npm-url]: https://npmjs.org/package/@stdlib/number-float32-base-exponent
|
|
257
257
|
|
|
258
|
-
[test-image]: https://github.com/stdlib-js/number-float32-base-exponent/actions/workflows/test.yml/badge.svg?branch=v0.2.
|
|
259
|
-
[test-url]: https://github.com/stdlib-js/number-float32-base-exponent/actions/workflows/test.yml?query=branch:v0.2.
|
|
258
|
+
[test-image]: https://github.com/stdlib-js/number-float32-base-exponent/actions/workflows/test.yml/badge.svg?branch=v0.2.4
|
|
259
|
+
[test-url]: https://github.com/stdlib-js/number-float32-base-exponent/actions/workflows/test.yml?query=branch:v0.2.4
|
|
260
260
|
|
|
261
261
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/number-float32-base-exponent/main.svg
|
|
262
262
|
[coverage-url]: https://codecov.io/github/stdlib-js/number-float32-base-exponent?branch=main
|
|
@@ -268,8 +268,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
268
268
|
|
|
269
269
|
-->
|
|
270
270
|
|
|
271
|
-
[chat-image]: https://img.shields.io/
|
|
272
|
-
[chat-url]: https://
|
|
271
|
+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
|
|
272
|
+
[chat-url]: https://stdlib.zulipchat.com
|
|
273
273
|
|
|
274
274
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
275
275
|
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../lib/main.js", "../lib/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar getWord = require( '@stdlib/number-float32-base-to-word' );\nvar BIAS = require( '@stdlib/constants-float32-exponent-bias' );\n\n\n// VARIABLES //\n\n// Exponent mask: 0 11111111 00000000000000000000000\nvar EXP_MASK = 0x7f800000; // TODO: consider making an external constant\n\n\n// MAIN //\n\n/**\n* Returns an integer corresponding to the unbiased exponent of a single-precision floating-point number.\n*\n* @param {number} x - single-precision floating-point number\n* @returns {integer8} unbiased exponent\n*\n* @example\n* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );\n* var exp = exponentf( toFloat32( 3.14e34 ) ); // => 2**114 ~ 2.08e34\n* // returns 114\n*\n* @example\n* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );\n* var exp = exponentf( toFloat32( 3.14e-34 ) ); // => 2**-112 ~ 1.93e-34\n* // returns -112\n*\n* @example\n* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );\n* var exp = exponentf( toFloat32( -3.14 ) );\n* // returns 1\n*\n* @example\n* var exp = exponentf( 0.0 );\n* // returns -127\n*\n* @example\n* var exp = exponentf( NaN );\n* // returns 128\n*/\nfunction exponentf( x ) {\n\t// Convert `x` to an unsigned 32-bit integer corresponding to the IEEE 754 binary representation:\n\tvar w = getWord( x );\n\n\t// Apply a mask to isolate only the exponent bits and then shift off all bits which are part of the fraction:\n\tw = ( w & EXP_MASK ) >>> 23;\n\n\t// Remove the bias and return:\n\treturn w - BIAS;\n}\n\n\n// EXPORTS //\n\nmodule.exports = exponentf;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Return an integer corresponding to the unbiased exponent of a single-precision floating-point number.\n*\n* @module @stdlib/number-float32-base-exponent\n*\n* @example\n* var
|
|
5
|
-
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAU,QAAS,qCAAsC,EACzDC,EAAO,QAAS,yCAA0C,EAM1DC,EAAW,
|
|
4
|
+
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar getWord = require( '@stdlib/number-float32-base-to-word' );\nvar BIAS = require( '@stdlib/constants-float32-exponent-bias' );\n\n\n// VARIABLES //\n\n// Exponent mask: 0 11111111 00000000000000000000000\nvar EXP_MASK = 0x7f800000; // TODO: consider making an external constant\n\n\n// MAIN //\n\n/**\n* Returns an integer corresponding to the unbiased exponent of a single-precision floating-point number.\n*\n* @param {number} x - single-precision floating-point number\n* @returns {integer8} unbiased exponent\n*\n* @example\n* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );\n*\n* var exp = exponentf( toFloat32( 3.14e34 ) ); // => 2**114 ~ 2.08e34\n* // returns 114\n*\n* @example\n* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );\n*\n* var exp = exponentf( toFloat32( 3.14e-34 ) ); // => 2**-112 ~ 1.93e-34\n* // returns -112\n*\n* @example\n* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );\n*\n* var exp = exponentf( toFloat32( -3.14 ) );\n* // returns 1\n*\n* @example\n* var exp = exponentf( 0.0 );\n* // returns -127\n*\n* @example\n* var exp = exponentf( NaN );\n* // returns 128\n*/\nfunction exponentf( x ) {\n\t// Convert `x` to an unsigned 32-bit integer corresponding to the IEEE 754 binary representation:\n\tvar w = getWord( x );\n\n\t// Apply a mask to isolate only the exponent bits and then shift off all bits which are part of the fraction:\n\tw = ( w & EXP_MASK ) >>> 23;\n\n\t// Remove the bias and return:\n\treturn w - BIAS;\n}\n\n\n// EXPORTS //\n\nmodule.exports = exponentf;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Return an integer corresponding to the unbiased exponent of a single-precision floating-point number.\n*\n* @module @stdlib/number-float32-base-exponent\n*\n* @example\n* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );\n* var exponent = require( '@stdlib/number-float32-base-exponent' );\n*\n* var exp = exponent( toFloat32( 3.14e34 ) );\n* // returns 114 => 2**114 ~ 2.08e34\n*\n* exp = exponent( toFloat32( 3.14e-34 ) );\n* // returns -112 => 2**-112 ~ 1.93e-34\n*\n* exp = exponent( toFloat32( -3.14 ) );\n* // returns 1\n*\n* exp = exponent( 0 );\n* // returns -127\n*\n* exp = exponent( NaN );\n* // returns 128\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
|
|
5
|
+
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAU,QAAS,qCAAsC,EACzDC,EAAO,QAAS,yCAA0C,EAM1DC,EAAW,WAqCf,SAASC,EAAWC,EAAI,CAEvB,IAAIC,EAAIL,EAASI,CAAE,EAGnB,OAAAC,GAAMA,EAAIH,KAAe,GAGlBG,EAAIJ,CACZ,CAKAF,EAAO,QAAUI,ICjCjB,IAAIG,EAAO,IAKX,OAAO,QAAUA",
|
|
6
6
|
"names": ["require_main", "__commonJSMin", "exports", "module", "getWord", "BIAS", "EXP_MASK", "exponentf", "x", "w", "main"]
|
|
7
7
|
}
|
package/docs/types/index.d.ts
CHANGED
|
@@ -26,16 +26,19 @@
|
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
28
|
* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );
|
|
29
|
+
*
|
|
29
30
|
* var exp = exponentf( toFloat32( 3.14e34 ) ); // => 2**114 ~ 2.08e34
|
|
30
31
|
* // returns 114
|
|
31
32
|
*
|
|
32
33
|
* @example
|
|
33
34
|
* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );
|
|
35
|
+
*
|
|
34
36
|
* var exp = exponentf( toFloat32( 3.14e-34 ) ); // => 2**-112 ~ 1.93e-34
|
|
35
37
|
* // returns -112
|
|
36
38
|
*
|
|
37
39
|
* @example
|
|
38
40
|
* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );
|
|
41
|
+
*
|
|
39
42
|
* var exp = exponentf( toFloat32( -3.14 ) );
|
|
40
43
|
* // returns 1
|
|
41
44
|
*
|
package/lib/index.js
CHANGED
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
* @module @stdlib/number-float32-base-exponent
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
|
-
* var exponent = require( '@stdlib/number-float32-base-exponent' );
|
|
28
27
|
* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );
|
|
28
|
+
* var exponent = require( '@stdlib/number-float32-base-exponent' );
|
|
29
29
|
*
|
|
30
30
|
* var exp = exponent( toFloat32( 3.14e34 ) );
|
|
31
31
|
* // returns 114 => 2**114 ~ 2.08e34
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
* // returns 1
|
|
38
38
|
*
|
|
39
39
|
* exp = exponent( 0 );
|
|
40
|
-
* // returns
|
|
40
|
+
* // returns -127
|
|
41
41
|
*
|
|
42
42
|
* exp = exponent( NaN );
|
|
43
43
|
* // returns 128
|
package/lib/main.js
CHANGED
|
@@ -40,16 +40,19 @@ var EXP_MASK = 0x7f800000; // TODO: consider making an external constant
|
|
|
40
40
|
*
|
|
41
41
|
* @example
|
|
42
42
|
* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );
|
|
43
|
+
*
|
|
43
44
|
* var exp = exponentf( toFloat32( 3.14e34 ) ); // => 2**114 ~ 2.08e34
|
|
44
45
|
* // returns 114
|
|
45
46
|
*
|
|
46
47
|
* @example
|
|
47
48
|
* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );
|
|
49
|
+
*
|
|
48
50
|
* var exp = exponentf( toFloat32( 3.14e-34 ) ); // => 2**-112 ~ 1.93e-34
|
|
49
51
|
* // returns -112
|
|
50
52
|
*
|
|
51
53
|
* @example
|
|
52
54
|
* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );
|
|
55
|
+
*
|
|
53
56
|
* var exp = exponentf( toFloat32( -3.14 ) );
|
|
54
57
|
* // returns 1
|
|
55
58
|
*
|
package/manifest.json
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
2
|
+
"options": {},
|
|
3
|
+
"fields": [
|
|
4
|
+
{
|
|
5
|
+
"field": "src",
|
|
6
|
+
"resolve": true,
|
|
7
|
+
"relative": true
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"field": "include",
|
|
11
|
+
"resolve": true,
|
|
12
|
+
"relative": true
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"field": "libraries",
|
|
16
|
+
"resolve": false,
|
|
17
|
+
"relative": false
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"field": "libpath",
|
|
21
|
+
"resolve": true,
|
|
22
|
+
"relative": false
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"confs": [
|
|
26
|
+
{
|
|
27
|
+
"src": [
|
|
28
|
+
"./src/main.c"
|
|
29
|
+
],
|
|
30
|
+
"include": [
|
|
31
|
+
"./include"
|
|
32
|
+
],
|
|
33
|
+
"libraries": [],
|
|
34
|
+
"libpath": [],
|
|
35
|
+
"dependencies": [
|
|
36
|
+
"@stdlib/constants-float32-exponent-bias",
|
|
37
|
+
"@stdlib/constants-float32-exponent-mask",
|
|
38
|
+
"@stdlib/number-float32-base-to-word"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
42
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/number-float32-base-exponent",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Return an integer corresponding to the unbiased exponent of a single-precision floating-point number.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@stdlib/constants-float32-exponent-bias": "^0.2.
|
|
37
|
-
"@stdlib/constants-float32-exponent-mask": "^0.2.
|
|
38
|
-
"@stdlib/number-float32-base-to-word": "^0.2.
|
|
39
|
-
"@stdlib/utils-library-manifest": "^0.2.
|
|
36
|
+
"@stdlib/constants-float32-exponent-bias": "^0.2.3",
|
|
37
|
+
"@stdlib/constants-float32-exponent-mask": "^0.2.3",
|
|
38
|
+
"@stdlib/number-float32-base-to-word": "^0.2.2",
|
|
39
|
+
"@stdlib/utils-library-manifest": "^0.2.4"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {},
|
|
42
42
|
"engines": {
|