{"id":13624686,"url":"https://github.com/MikeMcl/decimal.js-light","last_synced_at":"2025-04-16T01:31:52.936Z","repository":{"id":4251937,"uuid":"52482543","full_name":"MikeMcl/decimal.js-light","owner":"MikeMcl","description":"The light version of decimal.js, an arbitrary-precision Decimal type for JavaScript.","archived":false,"fork":false,"pushed_at":"2024-04-24T06:36:44.000Z","size":665,"stargazers_count":370,"open_issues_count":5,"forks_count":48,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-06T13:11:51.387Z","etag":null,"topics":["arbitrary-precision","bigdecimal","bignumber","javascript","significant-digits"],"latest_commit_sha":null,"homepage":"http://mikemcl.github.io/decimal.js-light","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MikeMcl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-24T23:39:09.000Z","updated_at":"2024-10-29T11:30:56.000Z","dependencies_parsed_at":"2024-06-18T12:17:48.540Z","dependency_job_id":"a427cefa-8a79-4880-9d15-f72810cf96f3","html_url":"https://github.com/MikeMcl/decimal.js-light","commit_stats":{"total_commits":51,"total_committers":5,"mean_commits":10.2,"dds":"0.17647058823529416","last_synced_commit":"7bc73067d59ce04347b56e7998ff0bd2b91e22c2"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeMcl%2Fdecimal.js-light","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeMcl%2Fdecimal.js-light/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeMcl%2Fdecimal.js-light/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeMcl%2Fdecimal.js-light/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MikeMcl","download_url":"https://codeload.github.com/MikeMcl/decimal.js-light/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223368048,"owners_count":17134246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arbitrary-precision","bigdecimal","bignumber","javascript","significant-digits"],"created_at":"2024-08-01T21:01:45.195Z","updated_at":"2024-11-08T13:30:58.830Z","avatar_url":"https://github.com/MikeMcl.png","language":"JavaScript","readme":"![decimal.js-light](https://raw.githubusercontent.com/MikeMcl/decimal.js-light/gh-pages/decimaljslight.png)\n\nThe light version of [decimal.js](https://github.com/MikeMcl/decimal.js/), an arbitrary-precision Decimal type for JavaScript.\n\n[![Build Status](https://travis-ci.org/MikeMcl/decimal.js-light.svg)](https://travis-ci.org/MikeMcl/decimal.js-light)\n\n\u003cbr /\u003e\n\nThis library is the newest of the family of libraries: [bignumber.js](https://github.com/MikeMcl/bignumber.js/), [big.js](https://github.com/MikeMcl/big.js/), [decimal.js](https://github.com/MikeMcl/decimal.js/) and *decimal.js-light*.\u003cbr\u003e\nThe API is more or less a subset of the API of *decimal.js*.\n\n![API](https://raw.githubusercontent.com/MikeMcl/decimal.js-light/gh-pages/API.png)\n\n__Differences between this library and *decimal.js*__\n\nSize of *decimal.js* minified: 32.1 KB.\u003cbr\u003e\nSize of *decimal.js-light* minified: 12.7 KB.\n\nThis library does not include `NaN`, `Infinity` or `-0` as legitimate values, or work with values in other bases.\n\nHere, the `Decimal.round` property is just the default rounding mode for `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`. It does not apply to arithmetic operations, which are simply truncated at the required precision.\n\nIf rounding is required just apply it explicitly, for example\n\n```js\nx = new Decimal(2);\ny = new Decimal(3);\n\n// decimal.js\nx.dividedBy(y).toString();                       // '0.66666666666666666667'\n\n// decimal.js-light\nx.dividedBy(y).toString();                       // '0.66666666666666666666'\nx.dividedBy(y).toDecimalPlaces(19).toString();   // '0.6666666666666666667'\n```\n\nThe `naturalExponential`, `naturalLogarithm`, `logarithm`, and `toPower` methods in this library have by default a limited precision of around 100 digits. This limit can be increased at runtime using the `LN10` (the natural logarithm of ten) configuration object property.\n\nFor example, if a maximum precision of 400 digits is required for these operations use\n\n```js\n// 415 digits\nDecimal.set({\n  LN10: '2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286248633409525465082806756666287369098781689482907208325554680843799894826233198528393505308965377732628846163366222287698219886746543667474404243274365155048934314939391479619404400222105101714174800368808401264708068556774321622835522011480466371565912137345074785694768346361679210180644507064800027'\n});\n```\n\nAlso, in this library the `e` property of a Decimal is the base 10000000 exponent, not the base 10 exponent as in *decimal.js*.\u003cbr\u003e\nUse the `exponent` method to get the base 10 exponent.\n\n## Quickstart\n\nBrowser:\n\n```html\n\u003cscript src='path/to/decimal.js-light'\u003e\u003c/script\u003e\n```\n\nNode package manager:\n\n```shell\n$ npm install --save decimal.js-light\n```\n\n```js\n// Node.js\nvar Decimal = require('decimal.js-light');\n\n// Adjust the global configuration if required (these are the defaults)\nDecimal.set({\n  precision: 20,\n  rounding: Decimal.ROUND_HALF_UP,\n  toExpNeg: -7,\n  toExpPos: 21\n});\n\nphi = new Decimal('1.61803398874989484820458683436563811772030917980576');\n\nphi.toFixed(10);    // '1.6180339887'\n\nphi.times(2).minus(1).toPower(2).plus('1e-19').equals(5);    // true\n\n```\n\nSee the [documentation](http://mikemcl.github.io/decimal.js-light) for further information.\n\n[TypeScript](https://github.com/Microsoft/TypeScript) type declaration file contributed by [TANAKA Koichi](https://github.com/MugeSo).\n\n\n\n\n\n","funding_links":[],"categories":["javascript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMikeMcl%2Fdecimal.js-light","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMikeMcl%2Fdecimal.js-light","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMikeMcl%2Fdecimal.js-light/lists"}