{"id":14991131,"url":"https://github.com/vezel-dev/libap","last_synced_at":"2025-04-12T03:25:44.647Z","repository":{"id":246931367,"uuid":"818606435","full_name":"vezel-dev/libap","owner":"vezel-dev","description":"An arbitrary-precision numerics library, ported from LLVM to Zig with a C API.","archived":false,"fork":false,"pushed_at":"2025-04-10T11:31:08.000Z","size":34,"stargazers_count":3,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T12:52:30.809Z","etag":null,"topics":["c","llvm","numerics","zig"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/vezel-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-LLVM","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"vezel-dev","open_collective":"vezel"}},"created_at":"2024-06-22T10:10:19.000Z","updated_at":"2025-04-10T11:31:05.000Z","dependencies_parsed_at":"2024-07-05T22:57:38.855Z","dependency_job_id":"f844ed88-8456-49e5-b732-846b6d87365e","html_url":"https://github.com/vezel-dev/libap","commit_stats":{"total_commits":14,"total_committers":2,"mean_commits":7.0,"dds":0.2857142857142857,"last_synced_commit":"dd404350a3ce1e63c55519e5722e347373e06ae4"},"previous_names":["vezel-dev/libap"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vezel-dev%2Flibap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vezel-dev%2Flibap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vezel-dev%2Flibap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vezel-dev%2Flibap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vezel-dev","download_url":"https://codeload.github.com/vezel-dev/libap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248511282,"owners_count":21116383,"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":["c","llvm","numerics","zig"],"created_at":"2024-09-24T14:21:31.891Z","updated_at":"2025-04-12T03:25:44.634Z","avatar_url":"https://github.com/vezel-dev.png","language":"Zig","funding_links":["https://github.com/sponsors/vezel-dev","https://opencollective.com/vezel"],"categories":[],"sub_categories":[],"readme":"# libap\n\n\u003e [!WARNING]\n\u003e This is currently in-development vaporware.\n\nlibap is a port of [LLVM](https://llvm.org)'s arbitrary-precision (AP) numerics\ntypes to [Zig](https://ziglang.org), with an additional C API on top to allow C\nprograms to make use of the library as well.\n\nNote that the types offered by this library have a fixed, predetermined bit\nwidth and semantics; they do not grow to maintain precision. For example, when\ncreating an `ap.Int`, you have to specify exactly how many bits it should\noccupy. Any operation that produces a new value will have the same bit width,\nand any operation involving two `ap.Int` values requires that they have the\nsame bit width. Contrast with the types in\n[std.math.big](https://ziglang.org/documentation/master/std/#std.math.big) which\ngrow as necessary.\n\nMost applications that use arbitrary-precision numbers *do* want them to grow in\norder to maintain full precision. In other words, most users should look to\n`std.math.big` (or an equivalent C library). The types offered by libap are\nprimarily useful for compilers, emulators, cryptography, and other fields where\nthe desired precision is bounded and/or strict semantics are required.\n\n## Status\n\nlibap currently covers the following LLVM types:\n\n* [`APInt`](https://llvm.org/doxygen/classllvm_1_1APInt.html)\n* [`APSInt`](https://llvm.org/doxygen/classllvm_1_1APSInt.html)\n* [`APFloat`](https://llvm.org/doxygen/classllvm_1_1APFloat.html)\n* [`APFixedPoint`](https://llvm.org/doxygen/classllvm_1_1APFixedPoint.html)\n\nChanges made to these types in LLVM are periodically synchronized here. The\ncurrent `master` code is based on LLVM commit\n[`8b9c91ec7da0ca3daab8ff6711126443e500bb66`](https://github.com/llvm/llvm-project/commit/8b9c91ec7da0ca3daab8ff6711126443e500bb66).\n\n## Usage\n\nThe minimum Zig version supported by this project can be found in the\n`minimum_zig_version` field of the [`build.zig.zon`](build.zig.zon) file. We\ngenerally try to track the latest release of Zig.\n\nTo use libap in your Zig project, first add it as a package:\n\n```bash\nzig fetch --save=ap https://github.com/vezel-dev/libap/archive/vX.Y.Z.tar.gz\n# Or, to use Git:\nzig fetch --save=ap git+https://github.com/vezel-dev/libap.git#vX.Y.Z\n```\n\n(You can find the latest version on the\n[releases page](https://github.com/vezel-dev/libap/releases).)\n\nThen, consume the `ap` module in your `build.zig`:\n\n```zig\nconst libap = b.dependency(\"libap\", .{\n    .target = target,\n    .optimize = optimize,\n});\n\nexe.root_module.addImport(\"ap\", libap.module(\"ap\"));\n```\n\nYou should now be able to `@import(\"ap\")` in your Zig code.\n\n\u003c!-- TODO: Add a short API usage example. --\u003e\n\n## Installation\n\nIf you plan to use libap as a C library, you will likely want to install it\nsomewhere on your system since C does not have a package manager. To do so, grab\na source code archive from the\n[releases page](https://github.com/vezel-dev/libap/releases), and run\n`zig build --prefix $HOME/.local -Doptimize=ReleaseFast` or similar. This will\nbuild a static library by default; pass `-Dlinkage=dynamic` to build a dynamic\nlibrary instead.\n\nThe result will look like this:\n\n```console\n$ tree $HOME/.local\n/home/alexrp/.local\n├── include\n│   └── ap\n│       └── ap.h\n├── lib\n│   ├── libap.a\n│   └── pkgconfig\n│       └── libap.pc\n└── share\n    └── doc\n        └── libap\n            └── html\n                ├── index.html\n                ├── main.js\n                ├── main.wasm\n                └── sources.tar\n```\n\nAssuming you have set your `C_INCLUDE_PATH`, `LD_LIBRARY_PATH`, and\n`PKG_CONFIG_PATH` environment variables appropriately, you should now be able\nto use libap like any other C library.\n\n\u003c!-- TODO: Add a short API usage example. --\u003e\n\n## License\n\nThis project is licensed under the terms found in\n[`LICENSE-LLVM`](LICENSE-LLVM), i.e. the same license as the C++ code from which\nthis library was ported. This is the new LLVM license following the\n[LLVM relicensing effort](https://foundation.llvm.org/docs/relicensing).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvezel-dev%2Flibap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvezel-dev%2Flibap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvezel-dev%2Flibap/lists"}