{"_id":"r-add","_rev":"1-53e7818ad9c320e075ea602ca4718a11","name":"r-add","description":"Just because javascript can't calculate with large or extreme precise float numbers. A cross-browser, numerically stable way to add numbers in javascript.","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"r-add","version":"1.0.0","description":"Just because javascript can't calculate with large or extreme precise float numbers. A cross-browser, numerically stable way to add numbers in javascript.","main":"index.js","scripts":{"test":"mocha test --require expectations"},"repository":{"type":"git","url":"git+https://github.com/sarkiroka/r-add.git"},"keywords":["add","numbers","float","integer","long","double","single","short"],"author":{"name":"sarkiroka"},"license":"MIT","bugs":{"url":"https://github.com/sarkiroka/r-add/issues"},"homepage":"https://github.com/sarkiroka/r-add#readme","devDependencies":{"expectations":"^0.7.1","mocha":"^3.4.2"},"gitHead":"f7c4c47360b9e5e5ff2e6d6e408d5c19944bba4d","_id":"r-add@1.0.0","_npmVersion":"5.0.3","_nodeVersion":"6.7.0","_npmUser":{"name":"sarkiroka","email":"sarki_roka@freemail.hu"},"dist":{"integrity":"sha512-v7AKv8QjwgfvKbqztPjSQWhR+921l0VQ2WM6IOutMxy1Uy+7Wlvo2rRIpZ0B9DxqzmnDFh/WOZkAJlzChRUDcA==","shasum":"b9bf33299ccce6f49060f603d67491f0cb5335d4","tarball":"https://registry.npmjs.org/r-add/-/r-add-1.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCCcwrHHRAXU6qW7fpK13I9th5M9Uq451qcJIXvOlwMNgIgZ+PxVS1MG6KyKLPo2jbLdqdaZ8tXCB4FATeb9Xtxcio="}]},"maintainers":[{"name":"sarkiroka","email":"sarki_roka@freemail.hu"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/r-add-1.0.0.tgz_1499020277862_0.5831177777145058"}}},"readme":"# r-add\nJust because javascript can't calculate with large or float number, a cross-browser, numerically stable way to add numbers in javascript.\n\n## Installation\n```\nnpm i r-add\n```\n\n## Usage\n```javascript\nvar add = require('r-add');\nvar a = 0.1;\nvar b = 0.2;\n\n// the bad solution\nconsole.log(a + b); // prints 0.30000000000000004\n\n// the good solution\nadd(a, b, function (err, result){\n  console.log(result); // prints 0.3\n});\n```\n\n## Why?\n\nBecause the javascript uses IEEE 754 standard and it has only 64 bit for numbers. From this 52 bit for value and 11 bit for exponent and 1 for sign. This is the reason for max safe integer is 9007199254740991. This number is the maximum which javascript can calculate precisely.\n\nFor example:\n\n```javascript\nvar a = 9007199254740991 + 1;\nvar b = 9007199254740991 + 2;\nconsole.log(a == b); // prints true\n```\n\nOf course the type of this numbers are number but for maniacs the example works with type safe relation operator too:\n\n```javascript\nvar a = 9007199254740991 + 1;\nvar b = 9007199254740991 + 2;\nconsole.log(a === b); // prints true\n```\n\nAnd the maximum value of a number in javascript is only 1.7976931348623157e+308\n\nIt is unsuitable for precise scientific calculations.\n\n## Why string?\n\nSee above :)\n\nThe numbers cannot store the precise value of large or extreme accurate values. The strings can.\n","maintainers":[{"name":"sarkiroka","email":"sarki_roka@freemail.hu"}],"time":{"modified":"2022-05-14T00:04:22.460Z","created":"2017-07-02T18:31:18.767Z","1.0.0":"2017-07-02T18:31:18.767Z"},"homepage":"https://github.com/sarkiroka/r-add#readme","keywords":["add","numbers","float","integer","long","double","single","short"],"repository":{"type":"git","url":"git+https://github.com/sarkiroka/r-add.git"},"author":{"name":"sarkiroka"},"bugs":{"url":"https://github.com/sarkiroka/r-add/issues"},"license":"MIT","readmeFilename":"README.md"}