{"_id":"math-float64-normalize","_rev":"4-3228e8f9f71c13039f9cdd2b22eccd70","name":"math-float64-normalize","description":"Returns a normal number `y` and exponent `exp` satisfying `x = y * 2^exp`.","dist-tags":{"latest":"1.0.0"},"versions":{"0.0.0":{"name":"math-float64-normalize","version":"0.0.0","description":"Returns a normal number `y` and exponent `exp` satisfying `x = y * 2^exp`.","author":{"name":"Athan Reines","email":"kgryte@gmail.com"},"contributors":[{"name":"Athan Reines","email":"kgryte@gmail.com"}],"scripts":{"test":"if [ \"${TRAVIS}\" ]; then npm run test-ci; else npm run test-local; fi","test-local":"tape \"./test/*.js\" | tap-spec","test-ci":"npm run test-local && xvfb-run npm run test-browsers","test-cov":"istanbul cover --dir ./reports/coverage --report lcov tape -- \"./test/*.js\"","test-browsers":"browserify ./test/*.js | testling | tap-spec","coverage":"istanbul cover --dir ./reports/codecov/coverage --report lcovonly tape -- \"./test/*.js\" && cat ./reports/codecov/coverage/lcov.info | codecov && rm -rf ./reports/codecov"},"main":"./lib","repository":{"type":"git","url":"git://github.com/math-io/float64-normalize.git"},"keywords":["compute.io","compute-io","compute","computation","math.io","math-io","math","mathematics","float64","double","dbl","floating-point","ieee754","denormalized","normalize","subnormal","number","normal","float"],"bugs":{"url":"https://github.com/math-io/float64-normalize/issues"},"dependencies":{"const-smallest-float64":"^1.0.0","math-abs":"^1.0.2","validate.io-infinite":"^1.0.0"},"devDependencies":{"browserify":"12.x.x","codecov":"1.x.x","const-ninf-float64":"^1.0.0","const-pinf-float64":"^1.0.0","istanbul":"^0.4.1","jshint":"2.x.x","jshint-stylish":"2.x.x","math-power":"^1.0.0","math-round":"^1.0.0","tap-spec":"4.x.x","tape":"4.x.x","testling":"1.x.x"},"testling":{"files":["test/*.js"],"browsers":["iexplore/6.0..latest","firefox/3.0..latest","firefox/nightly","chrome/4.0..latest","chrome/canary","opera/10.0..latest","opera/next","safari/4.0..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"license":"MIT","gitHead":"2f5ee8ba3bf2910fd193a07f0621ca8a722de595","homepage":"https://github.com/math-io/float64-normalize#readme","_id":"math-float64-normalize@0.0.0","_shasum":"2da8cf5ae6b73967cb010aec5e3fb34cb5b150e4","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.3","_npmUser":{"name":"kgryte","email":"kgryte@gmail.com"},"dist":{"shasum":"2da8cf5ae6b73967cb010aec5e3fb34cb5b150e4","tarball":"https://registry.npmjs.org/math-float64-normalize/-/math-float64-normalize-0.0.0.tgz","integrity":"sha512-CktNS8FBQIY/JCpfLYzi6yfDJUozo2QT/iX+pEbVpDuUFVcKpOKqV0bmFc+1nRBi+oiAjtO7eb9Y7aUFpnLO/A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCx5bOjKjAxHOoLdZvgC19O89k7WJkx90v1MgBhXSwTcwIgc8yJMy4CthBBDEYbPmuPu7C/4bdgwIk0qFZFUa8KUD0="}]},"maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"}]},"1.0.0":{"name":"math-float64-normalize","version":"1.0.0","description":"Returns a normal number `y` and exponent `exp` satisfying `x = y * 2^exp`.","author":{"name":"Athan Reines","email":"kgryte@gmail.com"},"contributors":[{"name":"Athan Reines","email":"kgryte@gmail.com"}],"scripts":{"test":"if [ \"${TRAVIS}\" ]; then npm run test-ci; else npm run test-local; fi","test-local":"tape \"./test/*.js\" | tap-spec","test-ci":"npm run test-local && xvfb-run npm run test-browsers","test-cov":"istanbul cover --dir ./reports/coverage --report lcov tape -- \"./test/*.js\"","test-browsers":"browserify ./test/*.js | testling | tap-spec","coverage":"istanbul cover --dir ./reports/codecov/coverage --report lcovonly tape -- \"./test/*.js\" && cat ./reports/codecov/coverage/lcov.info | codecov && rm -rf ./reports/codecov"},"main":"./lib","repository":{"type":"git","url":"git://github.com/math-io/float64-normalize.git"},"keywords":["compute.io","compute-io","compute","computation","math.io","math-io","math","mathematics","float64","double","dbl","floating-point","ieee754","denormalized","normalize","subnormal","number","normal","float"],"bugs":{"url":"https://github.com/math-io/float64-normalize/issues"},"dependencies":{"const-smallest-float64":"^1.0.0","math-abs":"^1.0.2","validate.io-infinite":"^1.0.0"},"devDependencies":{"browserify":"12.x.x","codecov":"1.x.x","const-ninf-float64":"^1.0.0","const-pinf-float64":"^1.0.0","istanbul":"^0.4.1","jshint":"2.x.x","jshint-stylish":"2.x.x","math-power":"^1.0.0","math-round":"^1.0.0","tap-spec":"4.x.x","tape":"4.x.x","testling":"1.x.x"},"testling":{"files":["test/*.js"],"browsers":["iexplore/6.0..latest","firefox/3.0..latest","firefox/nightly","chrome/4.0..latest","chrome/canary","opera/10.0..latest","opera/next","safari/4.0..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"license":"MIT","gitHead":"be76d0bdc9fb2bf87b0e0b5159716118ef6b02b7","homepage":"https://github.com/math-io/float64-normalize#readme","_id":"math-float64-normalize@1.0.0","_shasum":"d8bba30804df177bf1d76f641315301fa1260077","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.3","_npmUser":{"name":"kgryte","email":"kgryte@gmail.com"},"dist":{"shasum":"d8bba30804df177bf1d76f641315301fa1260077","tarball":"https://registry.npmjs.org/math-float64-normalize/-/math-float64-normalize-1.0.0.tgz","integrity":"sha512-/R+Uy40gORVib8fTqlFw7EZ2rYxlHGI0bGnF2KPcGo6pLOsxxqebANxLBxRWL0o+PCJlb//l/YwJsXNQaGbEmA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIECN5/4hlP7R9oBmOU0uDD3uVPCqWCuZoxpaijVjIBRJAiBKTo61iD2500/xJ3cVoRYGtwj/b2fhLmKvhESXwgWv+Q=="}]},"maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"}]}},"readme":"Normalize\n===\n[![NPM version][npm-image]][npm-url] [![Build Status][build-image]][build-url] [![Coverage Status][coverage-image]][coverage-url] [![Dependencies][dependencies-image]][dependencies-url]\n\n> Returns a normal number `y` and exponent `exp` satisfying `x = y * 2^exp`.\n\n\n## Installation\n\n``` bash\n$ npm install math-float64-normalize\n```\n\n\n## Usage\n\n``` javascript\nvar normalize = require( 'math-float64-normalize' );\n```\n\n#### normalize( x )\n\nReturns a normal number `y` and exponent `exp` satisfying `x = y * 2^exp`.\n\n``` javascript\nvar out = normalize( 3.14e-319 );\n// returns [ 1.4141234400356668e-303, -52 ]\n```\n\nThe first element of the returned `array` corresponds to `y` and the second to `exp`.\n\n``` javascript\nvar pow = require( 'math-power' );\n\nvar y = out[ 0 ];\nvar exp = out[ 1 ];\n\nvar bool = ( y*pow(2,exp) === 3.14e-319 );\n// returns true\n```\n\nThe `function` expects a finite, non-zero `numeric` value `x`. If `x == 0`,\n\n``` javascript\nvar out = normalize( 0 );\n// returns [ 0, 0 ];\n```\n\nIf `x` is either positive or negative `infinity` or `NaN`,\n\n``` javascript\nvar pinf = require( 'const-pinf-float64' );\nvar ninf = require( 'const-ninf-float64' );\n\nvar out = normalize( pinf );\n// returns [ pinf, 0 ]\n\nout = normalize( ninf );\n// returns [ ninf, 0 ]\n\nout = normalize( NaN );\n// returns [ NaN, 0 ]\n```\n\n\n## Examples\n\n``` javascript\nvar round = require( 'math-round' );\nvar pow = require( 'math-power' );\nvar normalize = require( 'math-float64-normalize' );\n\nvar frac;\nvar exp;\nvar x;\nvar v;\nvar i;\n\n// Generate denormalized numbers and then normalize them...\nfor ( i = 0; i < 100; i++ ) {\n\t// Generate a random fraction:\n\tfrac = Math.random() * 10;\n\n\t// Generate an exponent on the interval (-308,-324):\n\texp = -309 - round( Math.random()*14 );\n\n\t// Create a subnormal number (~2.23e-308, ~4.94e-324):\n\tx = frac * pow( 10, exp );\n\n\t// Determine a `y` and an `exp` to \"normalize\" the subnormal:\n\tv = normalize( x );\n\n\tconsole.log( '%d = %d * 2^%d = %d', x, v[0], v[1], v[0]*pow(2,v[1]) );\n}\n```\n\nTo run the example code from the top-level application directory,\n\n``` bash\n$ node ./examples/index.js\n```\n\n\n---\n## Tests\n\n### Unit\n\nThis repository uses [tape][tape] for unit tests. To run the tests, execute the following command in the top-level application directory:\n\n``` bash\n$ make test\n```\n\nAll new feature development should have corresponding unit tests to validate correct functionality.\n\n\n### Test Coverage\n\nThis repository uses [Istanbul][istanbul] as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:\n\n``` bash\n$ make test-cov\n```\n\nIstanbul creates a `./reports/coverage` directory. To access an HTML version of the report,\n\n``` bash\n$ make view-cov\n```\n\n\n### Browser Support\n\nThis repository uses [Testling][testling] for browser testing. To run the tests in a (headless) local web browser, execute the following command in the top-level application directory:\n\n``` bash\n$ make test-browsers\n```\n\nTo view the tests in a local web browser,\n\n``` bash\n$ make view-browser-tests\n```\n\n<!-- [![browser support][browsers-image]][browsers-url] -->\n\n\n---\n## License\n\n[MIT license](http://opensource.org/licenses/MIT).\n\n\n## Copyright\n\nCopyright &copy; 2016. The [Compute.io][compute-io] Authors.\n\n\n[npm-image]: http://img.shields.io/npm/v/math-float64-normalize.svg\n[npm-url]: https://npmjs.org/package/math-float64-normalize\n\n[build-image]: http://img.shields.io/travis/math-io/float64-normalize/master.svg\n[build-url]: https://travis-ci.org/math-io/float64-normalize\n\n[coverage-image]: https://img.shields.io/codecov/c/github/math-io/float64-normalize/master.svg\n[coverage-url]: https://codecov.io/github/math-io/float64-normalize?branch=master\n\n[dependencies-image]: http://img.shields.io/david/math-io/float64-normalize.svg\n[dependencies-url]: https://david-dm.org/math-io/float64-normalize\n\n[dev-dependencies-image]: http://img.shields.io/david/dev/math-io/float64-normalize.svg\n[dev-dependencies-url]: https://david-dm.org/dev/math-io/float64-normalize\n\n[github-issues-image]: http://img.shields.io/github/issues/math-io/float64-normalize.svg\n[github-issues-url]: https://github.com/math-io/float64-normalize/issues\n\n[tape]: https://github.com/substack/tape\n[istanbul]: https://github.com/gotwarlost/istanbul\n[testling]: https://ci.testling.com\n\n[compute-io]: https://github.com/compute-io/\n","maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"}],"time":{"modified":"2022-06-19T16:39:07.992Z","created":"2016-01-17T04:46:48.366Z","0.0.0":"2016-01-17T04:46:48.366Z","1.0.0":"2016-01-17T04:47:22.603Z"},"homepage":"https://github.com/math-io/float64-normalize#readme","keywords":["compute.io","compute-io","compute","computation","math.io","math-io","math","mathematics","float64","double","dbl","floating-point","ieee754","denormalized","normalize","subnormal","number","normal","float"],"repository":{"type":"git","url":"git://github.com/math-io/float64-normalize.git"},"contributors":[{"name":"Athan Reines","email":"kgryte@gmail.com"}],"author":{"name":"Athan Reines","email":"kgryte@gmail.com"},"bugs":{"url":"https://github.com/math-io/float64-normalize/issues"},"license":"MIT","readmeFilename":"README.md"}