@stdlib/number-float32-base-exponent 0.2.2 → 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 CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2024 The Stdlib Authors.
1
+ Copyright (c) 2016-2026 The Stdlib Authors.
package/README.md CHANGED
@@ -63,7 +63,7 @@ var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );
63
63
  var exp = exponentf( toFloat32( 3.14e34 ) ); // => 2^114 ~ 2.08e34
64
64
  // returns 114
65
65
 
66
- exp = exponentf( toFloat32( 3.14e-34 ) ); // => 2^-112 ~ 1.93e-34
66
+ exp = exponentf( toFloat32( 3.14e-34 ) ); // => 2^-112 ~ 1.93e-34
67
67
  // returns -112
68
68
 
69
69
  exp = exponentf( toFloat32( -3.14 ) );
@@ -242,7 +242,7 @@ See [LICENSE][stdlib-license].
242
242
 
243
243
  ## Copyright
244
244
 
245
- Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
245
+ Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
246
246
 
247
247
  </section>
248
248
 
@@ -255,8 +255,8 @@ Copyright &copy; 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.2
259
- [test-url]: https://github.com/stdlib-js/number-float32-base-exponent/actions/workflows/test.yml?query=branch:v0.2.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 &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
268
268
 
269
269
  -->
270
270
 
271
- [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
272
- [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
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 exponent = require( '@stdlib/number-float32-base-exponent' );\n* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );\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 0\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,WAkCf,SAASC,EAAWC,EAAI,CAEvB,IAAIC,EAAIL,EAASI,CAAE,EAGnB,OAAAC,GAAMA,EAAIH,KAAe,GAGlBG,EAAIJ,CACZ,CAKAF,EAAO,QAAUI,IC9BjB,IAAIG,EAAO,IAKX,OAAO,QAAUA",
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
  }
@@ -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
  *
@@ -16,9 +16,6 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- /**
20
- * Header file containing function declarations.
21
- */
22
19
  #ifndef STDLIB_NUMBER_FLOAT32_BASE_EXPONENT_H
23
20
  #define STDLIB_NUMBER_FLOAT32_BASE_EXPONENT_H
24
21
 
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 0
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
- "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
- ]
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.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.1",
37
- "@stdlib/constants-float32-exponent-mask": "^0.2.1",
38
- "@stdlib/number-float32-base-to-word": "^0.2.1",
39
- "@stdlib/utils-library-manifest": "^0.2.1"
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": {
package/src/addon.c CHANGED
@@ -25,7 +25,6 @@
25
25
  /**
26
26
  * Receives JavaScript callback invocation data.
27
27
  *
28
- * @private
29
28
  * @param env environment under which the function is invoked
30
29
  * @param info callback data
31
30
  * @return Node-API value
@@ -76,7 +75,6 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
76
75
  /**
77
76
  * Initializes a Node-API module.
78
77
  *
79
- * @private
80
78
  * @param env environment under which the function is invoked
81
79
  * @param exports exports object
82
80
  * @return main export