motion
Version:
motion - moving development forward
77 lines (76 loc) • 10.4 kB
JSON
{
"_args": [
[
"big.js@https://registry.npmjs.org/big.js/-/big.js-3.1.3.tgz",
"/Users/nw/flint/packages/flint"
]
],
"_from": "big.js@>=3.0.2 <4.0.0",
"_id": "big.js@3.1.3",
"_inCache": true,
"_location": "/big.js",
"_phantomChildren": {},
"_requested": {
"name": "big.js",
"raw": "big.js@https://registry.npmjs.org/big.js/-/big.js-3.1.3.tgz",
"rawSpec": "https://registry.npmjs.org/big.js/-/big.js-3.1.3.tgz",
"scope": null,
"spec": "https://registry.npmjs.org/big.js/-/big.js-3.1.3.tgz",
"type": "remote"
},
"_requiredBy": [
"/loader-utils"
],
"_resolved": "https://registry.npmjs.org/big.js/-/big.js-3.1.3.tgz",
"_shasum": "4cada2193652eb3ca9ec8e55c9015669c9806978",
"_shrinkwrap": null,
"_spec": "big.js@https://registry.npmjs.org/big.js/-/big.js-3.1.3.tgz",
"_where": "/Users/nw/flint/packages/flint",
"author": {
"email": "M8ch88l@gmail.com",
"name": "Michael Mclaughlin"
},
"bugs": {
"url": "https://github.com/MikeMcl/big.js/issues"
},
"dependencies": {},
"description": "A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic",
"devDependencies": {},
"engines": {
"node": "*"
},
"files": [
"big.js",
"big.min.js"
],
"homepage": "https://github.com/MikeMcl/big.js#readme",
"keywords": [
"arbitrary",
"arithmetic",
"big",
"bigdecimal",
"bigint",
"biginteger",
"bignum",
"bignumber",
"decimal",
"float",
"number",
"precision"
],
"license": "MIT",
"main": "./big",
"name": "big.js",
"optionalDependencies": {},
"readme": "\r\n# big.js #\r\n\r\nA small, fast JavaScript library for arbitrary-precision decimal arithmetic.\r\n\r\nThe little sister to [bignumber.js](https://github.com/MikeMcl/bignumber.js/).\r\nSee also [decimal.js](https://github.com/MikeMcl/decimal.js/), and [here](https://github.com/MikeMcl/big.js/wiki) for the difference between them.\r\n\r\n## Features\r\n\r\n - Faster, smaller and easier-to-use than JavaScript versions of Java's BigDecimal\r\n - Only 2.7 KB minified and gzipped\r\n - Simple API\r\n - Replicates the `toExponential`, `toFixed` and `toPrecision` methods of JavaScript's Number type\r\n - Includes a `sqrt` method\r\n - Stores values in an accessible decimal floating point format\r\n - No dependencies\r\n - Comprehensive [documentation](http://mikemcl.github.io/big.js/) and test set\r\n\r\n## Load\r\n\r\nThe library is the single JavaScript file *big.js* (or *big.min.js*, which is *big.js* minified).\r\n\r\nIt can be loaded via a script tag in an HTML document for the browser\r\n\r\n <script src='./relative/path/to/big.js'></script>\r\n\r\nor as a CommonJS, [Node.js](http://nodejs.org) or AMD module using `require`.\r\n\r\n var Big = require('big.js');\r\n\r\nFor Node.js, the library is available from the npm registry:\r\n\r\n $ npm install big.js\r\n\r\n\r\n\r\n## Use\r\n\r\n*In all examples below, `var`, semicolons and `toString` calls are not shown.\r\nIf a commented-out value is in quotes it means `toString` has been called on the preceding expression.*\r\n\r\nThe library exports a single function: Big, the constructor of Big number instances.\r\nIt accepts a value of type Number, String or Big number Object.\r\n\r\n x = new Big(123.4567)\r\n y = Big('123456.7e-3') // 'new' is optional\r\n z = new Big(x)\r\n x.eq(y) && x.eq(z) && y.eq(z) // true\r\n\r\nA Big number is immutable in the sense that it is not changed by its methods.\r\n\r\n 0.3 - 0.1 // 0.19999999999999998\r\n x = new Big(0.3)\r\n x.minus(0.1) // \"0.2\"\r\n x // \"0.3\"\r\n\r\nThe methods that return a Big number can be chained.\r\n\r\n x.div(y).plus(z).times(9).minus('1.234567801234567e+8').plus(976.54321).div('2598.11772')\r\n x.sqrt().div(y).pow(3).gt(y.mod(z)) // true\r\n\r\nLike JavaScript's Number type, there are `toExponential`, `toFixed` and `toPrecision` methods.\r\n\r\n x = new Big(255.5)\r\n x.toExponential(5) // \"2.55500e+2\"\r\n x.toFixed(5) // \"255.50000\"\r\n x.toPrecision(5) // \"255.50\"\r\n\r\nThe maximum number of decimal places and the rounding mode used to round the results of the `div`, `sqrt` and `pow`\r\n(with negative exponent) methods is determined by the value of the `DP` and `RM` properties of the `Big` number constructor. \r\n\r\nThe other methods always give the exact result. \r\n\r\n(From *v3.0.0*, multiple Big number constructors can be created, see Change Log below.)\r\n\r\n Big.DP = 10\r\n Big.RM = 1\r\n\r\n x = new Big(2);\r\n y = new Big(3);\r\n z = x.div(y) // \"0.6666666667\"\r\n z.sqrt() // \"0.8164965809\"\r\n z.pow(-3) // \"3.3749999995\"\r\n z.times(z) // \"0.44444444448888888889\"\r\n z.times(z).round(10) // \"0.4444444445\"\r\n\r\n\r\nThe value of a Big number is stored in a decimal floating point format in terms of a coefficient, exponent and sign.\r\n\r\n x = new Big(-123.456);\r\n x.c // [1,2,3,4,5,6] coefficient (i.e. significand)\r\n x.e // 2 exponent\r\n x.s // -1 sign\r\n\r\nFor further information see the [API](http://mikemcl.github.io/big.js/) reference from the *doc* folder.\r\n\r\n## Test\r\n\r\nThe *test* directory contains the test scripts for each Big number method.\r\n\r\nThe tests can be run with Node or a browser.\r\n\r\nTo test a single method, from a command-line shell at the *test* directory, use e.g.\r\n\r\n $ node toFixed\r\n\r\nTo test all the methods\r\n\r\n $ node every-test\r\n\r\nFor the browser, see *single-test.html* and *every-test.html* in the *test/browser* directory.\r\n\r\n*big-vs-number.html* enables some of the methods of big.js to be compared with those of JavaScript's Number type.\r\n\r\n## Performance\r\n\r\nThe *perf* directory contains two applications and a *lib* directory containing the BigDecimal libraries used by both.\r\n\r\n*big-vs-bigdecimal.html* tests the performance of big.js against the JavaScript translations of two versions of BigDecimal, its use should be more or less self-explanatory.\r\n(The GWT version doesn't work in IE 6.)\r\n\r\n* GWT: java.math.BigDecimal\r\n<https://github.com/iriscouch/bigdecimal.js>\r\n* ICU4J: com.ibm.icu.math.BigDecimal\r\n<https://github.com/dtrebbien/BigDecimal.js>\r\n\r\nThe BigDecimal in Node's npm registry is the GWT version. Despite its seeming popularity I have found it to have some serious bugs, see the Node script *perf/lib/bigdecimal_GWT/bugs.js* for examples of flaws in its *remainder*, *divide* and *compareTo* methods.\r\n\r\n*bigtime.js* is a Node command-line application which tests the performance of big.js against the GWT version of\r\nBigDecimal from the npm registry.\r\n\r\nFor example, to compare the time taken by the big.js `plus` method and the BigDecimal `add` method:\r\n\r\n $ node bigtime plus 10000 40\r\n\r\nThis will time 10000 calls to each, using operands of up to 40 random digits and will check that the results match.\r\n\r\nFor help:\r\n\r\n $ node bigtime -h\r\n\r\n## Build\r\n\r\nI.e. minify.\r\n\r\nFor Node, if uglify-js is installed globally ( `npm install uglify-js -g` ) then\r\n\r\n uglifyjs -o ./big.min.js ./big.js\r\n\r\nwill create *big.min.js*.\r\n\r\nThe *big.min.js* already present was created with *Microsoft Ajax Minifier 5.11*.\r\n\r\n## TypeScript\r\n\r\nThe [DefinitelyTyped](https://github.com/borisyankov/DefinitelyTyped) project has a TypeScript [definitions file](https://github.com/borisyankov/DefinitelyTyped/blob/master/big.js/big.js.d.ts) for big.js.\r\n\r\nThe definitions file can be added to your project via the [big.js.TypeScript.DefinitelyTyped](https://www.nuget.org/packages/big.js.TypeScript.DefinitelyTyped/0.0.1) NuGet package or via [tsd](http://definitelytyped.org/tsd/).\r\n\r\n tsd query big.js --action install\r\n\r\nAny questions about the TypeScript definitions file should be addressed to the DefinitelyTyped project.\r\n\r\n## Feedback\r\n\r\nFeedback is welcome.\r\n\r\nBugs/comments/questions?\r\nOpen an issue, or email\r\n\r\nMichael\r\n<a href=\"mailto:M8ch88l@gmail.com\">M8ch88l@gmail.com</a>\r\n\r\nBitcoin donation to:\r\n**1DppGRQSjVSMgGxuygDEHQuWEdTiVEzJYG**\r\nThank you\r\n\r\n## Licence\r\n\r\nSee LICENCE.\r\n\r\n## Change Log\r\n\r\n####3.1.3\r\n\r\n* Minor documentation updates.\r\n\r\n####3.1.2\r\n\r\n* README typo.\r\n\r\n####3.1.1\r\n\r\n* API documentation update, including FAQ additions.\r\n\r\n####3.1.0\r\n\r\n* Renamed and exposed `TO_EXP_NEG` and `TO_EXP_POS` as `Big.E_NEG` and\r\n `Big.E_POS`.\r\n\r\n####3.0.2\r\n\r\n* Remove *.npmignore*, use `files` field in *package.json* instead.\r\n\r\n####3.0.1\r\n\r\n* Added `sub`, `add` and `mul` aliases.\r\n* Clean-up after lint.\r\n\r\n####3.0.0\r\n\r\n* 10/12/14 Added [multiple constructor functionality](http://mikemcl.github.io/big.js/#faq).\r\n* No breaking changes or other additions, but a major code reorganisation,\r\n so *v3* seemed appropiate.\r\n\r\n####2.5.2\r\n\r\n* 1/11/14 Added bower.json.\r\n\r\n####2.5.1\r\n\r\n* 8/06/14 Amend README requires.\r\n\r\n####2.5.0\r\n\r\n* 26/01/14 Added `toJSON` method so serialization uses `toString`.\r\n\r\n####2.4.1\r\n\r\n* 17/10/13 Conform signed zero to IEEEE 754 (2008).\r\n\r\n####2.4.0\r\n\r\n* 19/09/13 Throw instances of `Error`.\r\n\r\n####2.3.0\r\n\r\n* 16/09/13 Added `cmp` method.\r\n\r\n####2.2.0\r\n\r\n* 11/07/13 Added 'round up' mode.\r\n\r\n####2.1.0\r\n\r\n* 26/06/13 Allow e.g. `.1` and `2.`.\r\n\r\n####2.0.0\r\n\r\n* 12/05/13 Added `abs` method and replaced `cmp` with `eq`, `gt`, `gte`, `lt`, and `lte` methods.\r\n\r\n####1.0.1\r\n\r\n* Changed default value of MAX_DP to 1E6\r\n\r\n####1.0.0\r\n\r\n* 7/11/2012 Initial release\r\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/MikeMcl/big.js.git"
},
"scripts": {
"build": "uglifyjs -o ./big.min.js ./big.js",
"test": "node ./test/every-test.js"
},
"version": "3.1.3"
}