{"_id":"math-float64-frexp","_rev":"4-f625466705998a5be9eb37cbf7040f61","name":"math-float64-frexp","description":"Splits a double-precision floating-point number into a normalized fraction and an integer power of two.","dist-tags":{"latest":"1.0.0"},"versions":{"0.0.0":{"name":"math-float64-frexp","version":"0.0.0","description":"Splits a double-precision floating-point number into a normalized fraction and an integer power of two.","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-frexp.git"},"keywords":["compute.io","compute-io","compute","computation","math.io","math-io","math","mathematics","frexp","floating-point","float64","float","double","dbl","normalized","normal","subnormal","denormalized","number"],"bugs":{"url":"https://github.com/math-io/float64-frexp/issues"},"dependencies":{"const-ninf-float64":"^1.0.0","const-pinf-float64":"^1.0.0","math-float64-exponent":"^1.0.0","math-float64-from-words":"^1.0.0","math-float64-normalize":"^1.0.0","math-float64-to-words":"^1.0.0"},"devDependencies":{"browserify":"12.x.x","codecov":"1.x.x","istanbul":"^0.4.1","jshint":"2.x.x","jshint-stylish":"2.x.x","math-abs":"^1.0.2","math-power":"^1.0.0","math-round":"^1.0.0","object-keys":"^1.0.9","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":"ff497db6e1235b9fb7098c3d767306e72dbae6f9","homepage":"https://github.com/math-io/float64-frexp#readme","_id":"math-float64-frexp@0.0.0","_shasum":"b857313d1f4a360d2acfb74694fe04a09ffabdc8","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.3","_npmUser":{"name":"kgryte","email":"kgryte@gmail.com"},"dist":{"shasum":"b857313d1f4a360d2acfb74694fe04a09ffabdc8","tarball":"https://registry.npmjs.org/math-float64-frexp/-/math-float64-frexp-0.0.0.tgz","integrity":"sha512-S8XmQZsTep+adzQprVx4mZQDZOxDhkIniUdCla3daHCeB8oKad7SLA0grei+u4DtDM1R3kV3rcqGF40S7EDfWQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFjZcxTIQ/pP9s5DKKHVyL1TS0r1seyWz2s0jrRwHiKiAiA7lj6IpIEDIa/QDaDfF+5nGneW217LGw8aeLU52LLg1Q=="}]},"maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"}]},"1.0.0":{"name":"math-float64-frexp","version":"1.0.0","description":"Splits a double-precision floating-point number into a normalized fraction and an integer power of two.","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-frexp.git"},"keywords":["compute.io","compute-io","compute","computation","math.io","math-io","math","mathematics","frexp","floating-point","float64","float","double","dbl","normalized","normal","subnormal","denormalized","number"],"bugs":{"url":"https://github.com/math-io/float64-frexp/issues"},"dependencies":{"const-ninf-float64":"^1.0.0","const-pinf-float64":"^1.0.0","math-float64-exponent":"^1.0.0","math-float64-from-words":"^1.0.0","math-float64-normalize":"^1.0.0","math-float64-to-words":"^1.0.0"},"devDependencies":{"browserify":"12.x.x","codecov":"1.x.x","istanbul":"^0.4.1","jshint":"2.x.x","jshint-stylish":"2.x.x","math-abs":"^1.0.2","math-power":"^1.0.0","math-round":"^1.0.0","object-keys":"^1.0.9","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":"85cf8980ececd49b5f805b0547dbd22db2b7811c","homepage":"https://github.com/math-io/float64-frexp#readme","_id":"math-float64-frexp@1.0.0","_shasum":"cca960d4fcccff3018909f86174994852113d505","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.3","_npmUser":{"name":"kgryte","email":"kgryte@gmail.com"},"dist":{"shasum":"cca960d4fcccff3018909f86174994852113d505","tarball":"https://registry.npmjs.org/math-float64-frexp/-/math-float64-frexp-1.0.0.tgz","integrity":"sha512-QGlFU0AUSsH8kyr1RH9UzJyuPIKDW5KuwGNIklgJzB/OA8rr6Wqklh72Oc1YqUi2hvfY7dwA/3OIO5ojtmLbXQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG46xFLujcQ0wPM8FqN+5RUckRg4ariXaxB+3AcA+sJUAiB4NF05xV1XPVkLBrU9xSTaA3XbPtrZd6FR8R+MKgc2dw=="}]},"maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"}]}},"readme":"frexp\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> Splits a [double-precision floating-point number][ieee754] into a normalized fraction and an integer power of two.\n\n\n## Installation\n\n``` bash\n$ npm install math-float64-frexp\n```\n\n\n## Usage\n\n``` javascript\nvar frexp = require( 'math-float64-frexp' );\n```\n\n#### frexp( x )\n\nSplits a [double-precision floating-point number][ieee754] into a normalized fraction and an integer power of two.\n\n``` javascript\nvar out = frexp( 4 );\n// returns [ 0.5, 3 ]\n```\n\nThe first element of the returned `array` is the normalized fraction and the second is the exponent. The normalized fraction and exponent satisfy the relation `x = frac * 2**exp`.\n\n``` javascript\nvar pow = require( 'math-power' );\n\nvar x = 4;\nvar out = frexp( x );\n// returns [ 0.5, 3 ]\n\nvar frac = out[ 0 ];\nvar exp = out[ 1 ];\n\nvar bool = ( x === frac * pow(2,exp) );\n// returns true\n```\n\nIf provided positive or negative `zero`, `NaN`, or positive or negative `infinity`, the `function` returns a two-element `array` containing the input value and an exponent equal to `0`.\n\n``` javascript\nvar out = frexp( 0 );\n// returns [ 0, 0 ]\n\nout = frexp( -0 );\n// returns [ -0, 0 ]\n\nout = frexp( NaN );\n// returns [ NaN, 0 ]\n\nout = frexp( Number.POSITIVE_INFINITY );\n// returns [ +infinity, 0 ]\n\nout = frexp( Number.NEGATIVE_INFINITY );\n// returns [ -infinity, 0 ]\n```\n\nFor all other `numeric` input values, the [absolute value][math-abs] of the normalized fraction resides on the interval `[1/2,1)`.\n\n\n## Notes\n\n*\tCare should be taken when reconstituting a [double-precision floating-point number][ieee754] from a normalized fraction and an exponent. For example,\n\n\t``` javascript\n\tvar pow = require( 'math-power' );\n\n\t// x ~ 2**1023\n\tvar x = 8.988939926493918e+307;\n\n\tvar out = frexp( x );\n\t// returns [ 0.5000263811533315, 1024 ]\n\n\t// Naive reconstitution:\n\tvar y = out[ 0 ] * pow( 2, out[ 1 ] );\n\t// returns +infinity\n\n\t// Account for 2**1024 evaluating as infinity by recognizing 2**1024 = 2**1 * 2**1023:\n\ty = out[ 0 ] * pow( 2, out[1]-1023 ) * pow( 2, 1023 );\n\t// returns 8.988939926493918e+307\n\t```\n\n\n## Examples\n\n``` javascript\nvar round = require( 'math-round' );\nvar pow = require( 'math-power' );\nvar frexp = require( 'math-float64-frexp' );\n\nvar sign;\nvar frac;\nvar exp;\nvar x;\nvar f;\nvar v;\nvar i;\n\n// Generate random numbers and break each into a normalized fraction and an integer power of two...\nfor ( i = 0; i < 100; i++ ) {\n\tif ( Math.random() < 0.5 ) {\n\t\tsign = -1;\n\t} else {\n\t\tsign = 1;\n\t}\n\tfrac = Math.random() * 10;\n\texp = round( Math.random()*616 ) - 308;\n\tx = sign * frac * pow( 10, exp );\n\tf = frexp( x );\n\tif ( f[ 1 ] > 1023 ) {\n\t\tv = f[ 0 ] * pow( 2, f[1]-1023 ) * pow( 2, 1023 );\n\t} else {\n\t\tv = f[ 0 ] * pow( 2, f[ 1 ] );\n\t}\n\tconsole.log( '%d = %d * 2^%d = %d', x, f[ 0 ], f[ 1 ], v );\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-frexp.svg\n[npm-url]: https://npmjs.org/package/math-float64-frexp\n\n[build-image]: http://img.shields.io/travis/math-io/float64-frexp/master.svg\n[build-url]: https://travis-ci.org/math-io/float64-frexp\n\n[coverage-image]: https://img.shields.io/codecov/c/github/math-io/float64-frexp/master.svg\n[coverage-url]: https://codecov.io/github/math-io/float64-frexp?branch=master\n\n[dependencies-image]: http://img.shields.io/david/math-io/float64-frexp.svg\n[dependencies-url]: https://david-dm.org/math-io/float64-frexp\n\n[dev-dependencies-image]: http://img.shields.io/david/dev/math-io/float64-frexp.svg\n[dev-dependencies-url]: https://david-dm.org/dev/math-io/float64-frexp\n\n[github-issues-image]: http://img.shields.io/github/issues/math-io/float64-frexp.svg\n[github-issues-url]: https://github.com/math-io/float64-frexp/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[ieee754]: https://en.wikipedia.org/wiki/IEEE_754-1985\n[math-abs]: https://github.com/math-io/abs\n","maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"}],"time":{"modified":"2022-06-19T16:38:59.996Z","created":"2016-01-20T03:58:01.372Z","0.0.0":"2016-01-20T03:58:01.372Z","1.0.0":"2016-01-20T03:58:27.019Z"},"homepage":"https://github.com/math-io/float64-frexp#readme","keywords":["compute.io","compute-io","compute","computation","math.io","math-io","math","mathematics","frexp","floating-point","float64","float","double","dbl","normalized","normal","subnormal","denormalized","number"],"repository":{"type":"git","url":"git://github.com/math-io/float64-frexp.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-frexp/issues"},"license":"MIT","readmeFilename":"README.md"}