{"id":25135571,"url":"https://github.com/exoad/big_double.dart","last_synced_at":"2026-01-11T04:41:51.045Z","repository":{"id":273306525,"uuid":"918435614","full_name":"exoad/big_double.dart","owner":"exoad","description":"BigInt \u0026 double replacement that can hold more than 1^308 and up to 10^^308","archived":false,"fork":false,"pushed_at":"2025-02-02T18:47:12.000Z","size":145,"stargazers_count":1,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T16:46:22.775Z","etag":null,"topics":["big-number","dart"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/big_double","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/exoad.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":"exoad","thanks_dev":null,"custom":null}},"created_at":"2025-01-17T23:43:16.000Z","updated_at":"2025-02-02T18:47:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"68021362-d694-4d7f-bbb4-9ab3de529667","html_url":"https://github.com/exoad/big_double.dart","commit_stats":null,"previous_names":["exoad/break_infinity.dart","exoad/big_double"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exoad%2Fbig_double.dart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exoad%2Fbig_double.dart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exoad%2Fbig_double.dart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exoad%2Fbig_double.dart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/exoad","download_url":"https://codeload.github.com/exoad/big_double.dart/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246924106,"owners_count":20855666,"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":["big-number","dart"],"created_at":"2025-02-08T16:33:56.546Z","updated_at":"2026-01-11T04:41:51.006Z","avatar_url":"https://github.com/exoad.png","language":"Dart","funding_links":["https://buymeacoffee.com/exoad","https://www.buymeacoffee.com/exoad"],"categories":[],"sub_categories":[],"readme":"# big_double.dart\n![Tests](https://img.shields.io/github/actions/workflow/status/exoad/big_double/test.yml?style=flat-square\u0026label=tests%20status)\n\n`BigInt` and `double` replacement that can hold up to $10^{10^{308}}$ for Dart. The goal of this library is to focus on speed and memory footprint rather than accuracy especially when the value is very very large leading to traditional approaches like `BigInt` performing horribly.\n\n\u003ca href=\"https://www.buymeacoffee.com/exoad\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" style=\"width:170px\" \u003e\u003c/a\u003e\n\n## Installation\nInstall the library\n\n```bash\ndart pub add big_double\n```\n\nor\n\n```bash\nflutter pub add big_double\n```\n\nImport the library into your project\n\n```dart\nimport \"package:big_double/big_double.dart\";\n```\n\n## Using a BIG double\n\nThere are multiple ways to acquire a `BigDouble`. A `BigDouble` is the class that contains the value and can be constructed via multiple\nmethods:\n\n### Initialization\n\n#### 💡 Numerical Suffix\n\n***Recommended***\n\nAll `double` and `int` types have an extension `.big` that can be used to easily turn that value into a `BigDouble` instance:\n\n```dart\nprint(1.big + 2.big);\n```\n\nFurthermore, there are also extensions on 2 tuple types: `(int, int)` and `(double, int)` which are represented by default for the `BigDouble`\ninternal structure. The first parameter is always the **mantissa** value, while the second parameter is the **exponent** value.\n\n```dart\nprint((12.0, 3).big + (4, 10).big);\n```\n\n#### 💡 String Parsing\n\n***Recommended***\n\n`BigDouble.parse(String)` and `BigDouble.tryParse(String)` are useful when the value is just now too large to represent with numerical literals. It is also paired with the `toString()` method for easy back-and-forth serializing and deserializing. The format must follow the format of `{mantissa}e{exponent}`\n\n\u003e Additionally, the `tryParse` variant will return `BigDouble.nan` if parsing failed, while `parse` throws a `FormatException`.\n\n```dart\nprint(BigDouble.parse(\"1e30\"));\n```\n\n#### Direct Initialization with Constructor\n\nIf you have your method of storing the original value, then you can use this method to get the value back. The default constructor `BigDouble(double, int)` provides you with a way to supply the mantissa and exponent respectively.\n\n```dart\nprint(BigDouble(1, 308)); // would be equivalent to saying 1e308\n```\n\n### Arithmetic\n\nAll basic arithmetic operations are supported such as `+`, `-`, `*`, `/`, and `-` (negation) and all of which are handled through operator overloading:\n\n```dart\nprint(1.big + 3.big); // 4.big\n```\n\n### Accessibility \u0026 Safety\n\nWithin every `BigDouble`, its value is represented by 2 values previously mentioned:\n1. **Mantissa** - Contains the significant digits in the number. (*Significand*)\n2. **Exponent** - Represents the number of decimal places that need to be moved.\n\nYou can **view** these values with just a `BigDouble`. **However, you are not allowed to directly modify the values.** This is because directly modifying these values will cause the `BigDouble` to become not normalized leading to certain operations potentially producing incorrect results.\n\n\u003e [!CAUTION]\n\u003e If you want to modify these values, you must use the `BigIntrospect` class, but keep in mind, that you must manually normalize the `BigDouble` instance after.\n\n```dart\nBigDouble a = 3.big;\nprint(a.mantissa); // OK\na.exponent = 100;  // ERROR\nBigIntrospect.changeExponent(a, 100); // OK\n```\n\n### Math Library\n\nThere are additional helper functions for you to use that help you with additional computations. For example, the `pow(BigDouble, double)` function which raises a `BigDouble` to a certain power. All of the function styles have been adapted from Dart's format such as how a double has `.abs()` which will make utilizing\na `BigDouble` just like using vanilla Dart!\n\n🥳 _**Voilà!**_ For more information on additional usage, read the documentation [here]().\n\n## Compatibility \u0026 Limitations\n\nThis library primarily operates to support both `native` and `web` platforms. These platforms are as follows\n\n\u003e * **Dart Native**: For programs targeting devices (mobile, desktop, server, and more), Dart Native includes both a Dart VM with JIT (just-in-time) compilation and an AOT (ahead-of-time) compiler for producing machine code.\n\u003e * **Dart Web**: For programs targeting the web, Dart Web includes both a development time compiler (dartdevc) and a production time compiler (dart2js).\n\u003e\n\u003e From [dart-lang/sdk](https://github.com/dart-lang/sdk)\n\n\u003e [!WARNING]\n\u003e However, the internal workings of this library depend on `int` and `double`, but the constraints of these [types vary between `web` and `native`](https://dart.dev/language/built-in-types#numbers) which will need to be taken into consideration when using this package, but for the most part, a lot of the constraints have been solved\n\u003e within this library itself.\n\n## Acknowledgements\n\n### [Patashu/big_double.js](https://github.com/Patashu/big_double.js)\n\n### [AD417/BreakInfinity.java](https://github.com/AD417/BreakInfinity.java)\n\n### [Patashu/break_eternity.js](https://github.com/Patashu/break_eternity.js)\n\n### Contributors\n\n\u003ca href=\"https://github.com/exoad/big_double.dart/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=exoad/big_double.dart\" /\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexoad%2Fbig_double.dart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexoad%2Fbig_double.dart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexoad%2Fbig_double.dart/lists"}