🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

@stdlib/number-float32-base-exponent

Package Overview
Dependencies
Maintainers
4
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stdlib/number-float32-base-exponent - npm Package Compare versions

Comparing version
0.2.3
to
0.2.4
+2
-2
dist/index.js.map
{
"version": 3,
"sources": ["../lib/main.js", "../lib/index.js"],
"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"],
"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",
"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"],
"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",
"names": ["require_main", "__commonJSMin", "exports", "module", "getWord", "BIAS", "EXP_MASK", "exponentf", "x", "w", "main"]
}

@@ -29,2 +29,3 @@ /*

* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );
*
* var exp = exponentf( toFloat32( 3.14e34 ) ); // => 2**114 ~ 2.08e34

@@ -35,2 +36,3 @@ * // returns 114

* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );
*
* var exp = exponentf( toFloat32( 3.14e-34 ) ); // => 2**-112 ~ 1.93e-34

@@ -41,2 +43,3 @@ * // returns -112

* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );
*
* var exp = exponentf( toFloat32( -3.14 ) );

@@ -43,0 +46,0 @@ * // returns 1

@@ -19,5 +19,2 @@ /**

/**
* Header file containing function declarations.
*/
#ifndef STDLIB_NUMBER_FLOAT32_BASE_EXPONENT_H

@@ -24,0 +21,0 @@ #define STDLIB_NUMBER_FLOAT32_BASE_EXPONENT_H

@@ -27,4 +27,4 @@ /**

* @example
* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );
* var exponent = require( '@stdlib/number-float32-base-exponent' );
* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );
*

@@ -41,3 +41,3 @@ * var exp = exponent( toFloat32( 3.14e34 ) );

* exp = exponent( 0 );
* // returns 0
* // returns -127
*

@@ -44,0 +44,0 @@ * exp = exponent( NaN );

@@ -43,2 +43,3 @@ /**

* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );
*
* var exp = exponentf( toFloat32( 3.14e34 ) ); // => 2**114 ~ 2.08e34

@@ -49,2 +50,3 @@ * // returns 114

* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );
*
* var exp = exponentf( toFloat32( 3.14e-34 ) ); // => 2**-112 ~ 1.93e-34

@@ -55,2 +57,3 @@ * // returns -112

* var toFloat32 = require( '@stdlib/number-float64-base-to-float32' );
*
* var exp = exponentf( toFloat32( -3.14 ) );

@@ -57,0 +60,0 @@ * // returns 1

{
"options": {},
"fields": [
{
"field": "src",
"resolve": true,
"relative": true
},
{
"field": "include",
"resolve": true,
"relative": true
},
{
"field": "libraries",
"resolve": false,
"relative": false
},
{
"field": "libpath",
"resolve": true,
"relative": false
}
],
"confs": [
{
"src": [
"./src/main.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/constants-float32-exponent-bias",
"@stdlib/constants-float32-exponent-mask",
"@stdlib/number-float32-base-to-word"
]
}
]
"options": {},
"fields": [
{
"field": "src",
"resolve": true,
"relative": true
},
{
"field": "include",
"resolve": true,
"relative": true
},
{
"field": "libraries",
"resolve": false,
"relative": false
},
{
"field": "libpath",
"resolve": true,
"relative": false
}
],
"confs": [
{
"src": [
"./src/main.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/constants-float32-exponent-bias",
"@stdlib/constants-float32-exponent-mask",
"@stdlib/number-float32-base-to-word"
]
}
]
}
+1
-1

@@ -1,1 +0,1 @@

Copyright (c) 2016-2024 The Stdlib Authors.
Copyright (c) 2016-2026 The Stdlib Authors.
{
"name": "@stdlib/number-float32-base-exponent",
"version": "0.2.3",
"version": "0.2.4",
"description": "Return an integer corresponding to the unbiased exponent of a single-precision floating-point number.",

@@ -36,6 +36,6 @@ "license": "Apache-2.0",

"dependencies": {
"@stdlib/constants-float32-exponent-bias": "^0.2.2",
"@stdlib/constants-float32-exponent-mask": "^0.2.2",
"@stdlib/number-float32-base-to-word": "^0.2.1",
"@stdlib/utils-library-manifest": "^0.2.2"
"@stdlib/constants-float32-exponent-bias": "^0.2.3",
"@stdlib/constants-float32-exponent-mask": "^0.2.3",
"@stdlib/number-float32-base-to-word": "^0.2.2",
"@stdlib/utils-library-manifest": "^0.2.4"
},

@@ -42,0 +42,0 @@ "devDependencies": {},

@@ -245,3 +245,3 @@ <!--

Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
Copyright &copy; 2016-2026. The Stdlib [Authors][stdlib-authors].

@@ -259,4 +259,4 @@ </section>

[test-image]: https://github.com/stdlib-js/number-float32-base-exponent/actions/workflows/test.yml/badge.svg?branch=v0.2.3
[test-url]: https://github.com/stdlib-js/number-float32-base-exponent/actions/workflows/test.yml?query=branch:v0.2.3
[test-image]: https://github.com/stdlib-js/number-float32-base-exponent/actions/workflows/test.yml/badge.svg?branch=v0.2.4
[test-url]: https://github.com/stdlib-js/number-float32-base-exponent/actions/workflows/test.yml?query=branch:v0.2.4

@@ -273,4 +273,4 @@ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/number-float32-base-exponent/main.svg

[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
[chat-url]: https://stdlib.zulipchat.com

@@ -277,0 +277,0 @@ [stdlib]: https://github.com/stdlib-js/stdlib