mirror of https://gitee.com/bigwinds/arangodb
32 lines
2.6 KiB
JSON
32 lines
2.6 KiB
JSON
{
|
||
"name": "decimal",
|
||
"description": "Simple decimal arithmetic for the browser and node.js!",
|
||
"author": {
|
||
"name": "Samori Gorse",
|
||
"email": "samorigorse@gmail.com"
|
||
},
|
||
"version": "0.0.2",
|
||
"keywords": [
|
||
"arithmetic",
|
||
"decimal",
|
||
"float",
|
||
"calculation"
|
||
],
|
||
"main": "./lib/decimal",
|
||
"repository": {
|
||
"type": "git",
|
||
"url": "git://github.com/shinuza/decimal-js.git"
|
||
},
|
||
"engines": {
|
||
"node": "0.4.x"
|
||
},
|
||
"readme": "Decimal\n======\n\nSimple decimal arithmetic for the browser *and* node.js!\n\n\nWhy?\n=======\n\n Why don’t my numbers, like 0.1 + 0.2 add up to a nice round 0.3,\n and instead I get a weird result like 0.30000000000000004?\n\n Because internally, computers use a format (binary floating-point)\n that cannot accurately represent a number like 0.1, 0.2 or 0.3 at all.\n\nSource : http://floating-point-gui.de/\n\nI wrote this because I needed to do simple computation in the browser\nand I couldn't find a lightweight library to do it.\n\nHow to use?\n===========\n\n\nIn the browser\n--------------\n\n <script src=\"lib/decimal.js\"></script>\n\nIn node\n-------\n\n npm install decimal\n\nthen in your program\n\n var Decimal = require('decimal');\n\n\nExamples\n=======\n\n >>> 1.1 + 2.2\n 3.3000000000000003\n\n >>> Decimal('1.1').add('2.2').toNumber()\n 3.3\n\n >>> 4.01 * 2.01\n 8.060099999999998\n\n >>> Decimal('4.01').mul('2.01').toNumber()\n 8.0601\n\n >>> Decimal.mul('4.01', '2.01').toNumber()\n 8.0601\n\n\nCan I help?\n===========\n\nOf course you can, I suck at math, and this implementation is very naive.\nIf you are a math Guru and you see something wrong or a\nway to simplify things you can send in a pull request.\n\n\nMethods\n=======\n\nDecimal(n)\n------------------\n\nCreate a new `Decimal` from `n`. `n` can be a string, integer, or\nanother `Decimal`.\n\n.toString()\n------------------\n\nReturns the `Decimal` instance as a string.\n\n.toNumber()\n-----------\n\nTurn a `Decimal` into a `Number`.\n\n.add(n)\n-------\n\nReturn a new `Decimal` containing the instance value plus `n`.\n\n.sub(n)\n-------\n\nReturn a new `Decimal` containing the instance value minus `n`.\n\n.mul(n)\n-------\n\nReturn a new `Decimal` containing the instance value multiplied by `n`.\n\n.div(n)\n-------\n\nReturn a new `Decimal` containing the instance value integrally divided by `n`.\n\n",
|
||
"readmeFilename": "README.md",
|
||
"bugs": {
|
||
"url": "https://github.com/shinuza/decimal-js/issues"
|
||
},
|
||
"homepage": "https://github.com/shinuza/decimal-js",
|
||
"_id": "decimal@0.0.2",
|
||
"_from": "decimal@"
|
||
}
|