{"id":27416481,"url":"https://github.com/declanvk/reckoner","last_synced_at":"2025-04-14T09:49:15.193Z","repository":{"id":36368227,"uuid":"217926113","full_name":"declanvk/reckoner","owner":"declanvk","description":"Simple arbitrary precision integer and rational arithmetic library","archived":false,"fork":false,"pushed_at":"2024-12-09T18:23:46.000Z","size":5358,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-11T01:57:21.889Z","etag":null,"topics":["arbitrary-precision","arithmetic","ffi-bindings"],"latest_commit_sha":null,"homepage":"https://declanvk.github.io/reckoner","language":"Rust","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/declanvk.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}},"created_at":"2019-10-27T22:40:09.000Z","updated_at":"2025-01-30T18:50:59.000Z","dependencies_parsed_at":"2023-11-19T01:27:35.588Z","dependency_job_id":"21282089-be18-4aad-aef0-c3b82e572de8","html_url":"https://github.com/declanvk/reckoner","commit_stats":{"total_commits":97,"total_committers":4,"mean_commits":24.25,"dds":0.3298969072164949,"last_synced_commit":"4cd3b8d1450d6f5c75ae606305236375cc3d37e7"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/declanvk%2Freckoner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/declanvk%2Freckoner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/declanvk%2Freckoner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/declanvk%2Freckoner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/declanvk","download_url":"https://codeload.github.com/declanvk/reckoner/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501861,"owners_count":21114683,"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","arithmetic","ffi-bindings"],"created_at":"2025-04-14T09:49:14.096Z","updated_at":"2025-04-14T09:49:15.178Z","avatar_url":"https://github.com/declanvk.png","language":"Rust","readme":"# Reckoner\n\nA high level arbitrary precision integer and rational arithmetic library wrapping [`imath`](https://github.com/creachadair/imath/).\n\n## Example\n\nThe following example computes an approximation of pi using the [Newton / Euler Convergence Transformation](https://en.wikipedia.org/wiki/Approximations_of_%CF%80#Other_classical_formulae).\n\n````rust\nuse reckoner::{Integer, Rational};\n\nfn factorial(v: \u0026Integer) -\u003e Integer {\n    let mut accum = 1.into();\n    let mut f = v.clone();\n\n    while f \u003e 0 {\n        accum *= \u0026f;\n        f -= 1;\n    }\n\n    accum\n}\n\n// Product of all odd integer up to the given value.\nfn odd_factorial(v: \u0026Integer) -\u003e Integer {\n    let mut accum = 1.into();\n    let mut f = if v % 2 == 0 { v - 1 } else { v.clone() };\n\n    while f \u003e 0 {\n        accum *= \u0026f;\n        f -= 2;\n    }\n\n    accum\n}\n\n// ```\n// \\frac{\\pi}{2}\n//     = \\sum_{k=0}^\\infty\\frac{k!}{(2k+1)!!}\n//     = \\sum_{k=0}^{\\infty} \\cfrac {2^k k!^2}{(2k + 1)!}\n//     = 1+\\frac{1}{3}\\left(1+\\frac{2}{5}\\left(1+\\frac{3}{7}\\left(1+\\cdots\\right)\\right)\\right)\n// ```\nfn compute_pi_approx(iterations: u32) -\u003e Rational {\n    2 * (0..iterations)\n        .map(Integer::from)\n        .map(|n| {\n            let numerator = factorial(\u0026n);\n            let denominator = odd_factorial(\u0026(2 * n + 1));\n\n            (numerator, denominator).into()\n        })\n        .sum::\u003cRational\u003e()\n}\n````\n\nSee [`examples/`](https://github.com/declanvk/reckoner/tree/main/examples) for more.\n\n## Crates\n\nThe MSRV for both crates is `1.70.0`.\n\n### `reckoner`\n\n[![crates.io](https://img.shields.io/crates/d/reckoner)](https://crates.io/crates/reckoner) [![docs.rs](https://docs.rs/reckoner/badge.svg)](https://docs.rs/reckoner)\n\nA high level arbitrary precision arithmetic library supporting integer and rational numbers.\n\n### `creachadair-imath-sys`\n\n[![crates.io](https://img.shields.io/crates/d/creachadair-imath-sys)](https://crates.io/crates/creachadair-imath-sys) [![docs.rs](https://docs.rs/creachadair-imath-sys/badge.svg)](https://docs.rs/creachadair-imath-sys)\n\nFFI bindings for [`imath`](https://github.com/creachadair/imath/).\n\n## Documentation\n\n[Documentation for `reckoner` from `main` branch](https://declanvk.github.io/reckoner/reckoner/index.html)\n\n[Documentation for `creachadair-imath-sys` from `main` branch](https://declanvk.github.io/reckoner/creachadair_imath_sys/index.html)\n\n## Contributing\n\nDownload the crate using the command\n\n```bash\ngit clone --recurse-submodules https://github.com/declanvk/reckoner\n```\n\nso that you also get the submodule sources, which are required to compile the `creachadair-imath-sys` crate. If you already cloned the project and forgot `--recurse-submodules`, you can combine the `git submodule init` and `git submodule update` steps by running `git submodule update --init`.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeclanvk%2Freckoner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeclanvk%2Freckoner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeclanvk%2Freckoner/lists"}