{"id":51509511,"url":"https://github.com/murphsicles/num-bigint","last_synced_at":"2026-07-08T04:30:57.607Z","repository":{"id":358483952,"uuid":"1240879605","full_name":"murphsicles/num-bigint","owner":"murphsicles","description":"Zeta port of num-bigint - arbitrary precision arithmetic BigUint/BigInt","archived":false,"fork":false,"pushed_at":"2026-05-17T15:13:34.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-17T17:37:04.501Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/murphsicles.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-16T17:25:35.000Z","updated_at":"2026-05-17T15:13:39.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/murphsicles/num-bigint","commit_stats":null,"previous_names":["murphsicles/num-bigint"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/murphsicles/num-bigint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murphsicles%2Fnum-bigint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murphsicles%2Fnum-bigint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murphsicles%2Fnum-bigint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murphsicles%2Fnum-bigint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/murphsicles","download_url":"https://codeload.github.com/murphsicles/num-bigint/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/murphsicles%2Fnum-bigint/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35252324,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-08T02:00:06.796Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-07-08T04:30:56.606Z","updated_at":"2026-07-08T04:30:57.601Z","avatar_url":"https://github.com/murphsicles.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# num-bigint\n\n[![@math/num-bigint](https://img.shields.io/badge/zorb-%40math%2Fnum--bigint-blue)](https://zorbs.io)\n\nArbitrary-precision big integer arithmetic for Zeta, ported from [num-bigint](https://github.com/rust-num/num-bigint).\n\nProvides `BigUint` (unsigned) and `BigInt` (signed) types with full arithmetic, comparison, and bitwise operations.\n\nEssential for blockchain/crypto work — satoshi amounts, transaction math, cryptographic operations.\n\n## Installation\n\n```toml\n[dependencies]\n\"@math/num-bigint\" = \"0.4.6\"\n```\n\n## Quick Start\n\n```zeta\nuse num_bigint::{BigUint, BigInt};\n\n// Create from primitives\nlet a = BigUint::from_u64(42);\nlet b = BigUint::from_u64(10);\n\n// Arithmetic\nlet sum = a.add(\u0026b);       // 52\nlet diff = a.sub(\u0026b);      // 32\nlet prod = a.mul(\u0026b);      // 420\nlet (q, r) = a.div_mod(\u0026b); // 4 rem 2\n\n// From strings (supports base 2-36)\nlet big = BigUint::from_str(\"12345678901234567890\", 10);\n\n// BigInt with sign\nlet neg = BigInt::from_i64(-100);\nlet pos = BigInt::from_i64(42);\nlet result = neg.add(\u0026pos); // -58\n```\n\n## Key Types\n\n### BigUint\n\nUnsigned arbitrary precision integer backed by a `Vec\u003cu64\u003e` of little-endian limbs.\n\n| Method | Description |\n|--------|-------------|\n| `from_u64(v)` | Create from u64 |\n| `from_str(s, base)` | Parse from string in given base (2-36) |\n| `zero()` / `one()` / `ten()` | Constants |\n| `add(\u0026other)` | Addition |\n| `sub(\u0026other)` | Subtraction (panics if underflow) |\n| `mul(\u0026other)` | Multiplication |\n| `div_mod(\u0026other)` | Division with remainder (quotient, remainder) |\n| `div(\u0026other)` | Division (floor) |\n| `modulo(\u0026other)` | Modulo |\n| `pow(exp)` | Exponentiation |\n| `shl(n)` / `shr(n)` | Bit shifts |\n| `bit_and` / `bit_or` / `bit_xor` | Bitwise operations |\n| `is_less_than` / `is_equal` / `is_greater_than` | Comparison |\n| `to_u64()` | Truncate to u64 |\n| `to_string()` | Decimal string representation |\n| `to_string_hex()` | Hex string representation |\n| `clone()` | Deep copy |\n\n### BigInt\n\nSigned arbitrary precision integer wrapping `BigUint` with a sign flag.\n\n| Method | Description |\n|--------|-------------|\n| `from_i64(v)` | Create from i64 |\n| `from_biguint(positive, value)` | Create from BigUint with sign |\n| `from_str(s, base)` | Parse from string |\n| `add(\u0026other)` | Signed addition |\n| `sub(\u0026other)` | Signed subtraction |\n| `mul(\u0026other)` | Signed multiplication |\n| `div(\u0026other)` | Truncated division toward zero |\n| `modulo(\u0026other)` | Remainder (sign follows dividend) |\n| `div_mod(\u0026other)` | Both quotient and remainder |\n| `pow(exp)` | Exponentiation |\n| `neg()` | Negation |\n| `abs()` | Absolute value |\n| `signum()` | Returns -1, 0, or 1 |\n| `cmp(\u0026other)` | Compare (-1, 0, 1) |\n| `is_positive()` / `is_negative()` / `is_zero()` | Sign checks |\n| `to_i64()` | Truncate to i64 |\n| `to_string()` | Decimal string |\n| `to_string_hex()` | Hex string |\n\n## Example: Blockchain satoshi math\n\n```zeta\nuse num_bigint::BigUint;\n\n// 1 BTC = 100,000,000 satoshis\nlet one_btc = BigUint::from_u64(100_000_000);\nlet fees = BigUint::from_u64(5_000);  // 0.00005 BTC fee\nlet amount = BigUint::from_str(\"2100000000000000\", 10); // 21M BTC in satoshis\nlet tx_out = amount.sub(\u0026fees);  // Subtract fee\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmurphsicles%2Fnum-bigint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmurphsicles%2Fnum-bigint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmurphsicles%2Fnum-bigint/lists"}