{"id":13726144,"url":"https://github.com/yawaramin/ocaml-decimal","last_synced_at":"2025-05-02T15:30:50.992Z","repository":{"id":56266669,"uuid":"311459565","full_name":"yawaramin/ocaml-decimal","owner":"yawaramin","description":"Arbitrary-precision floating-point decimals","archived":false,"fork":false,"pushed_at":"2025-01-26T16:18:12.000Z","size":629,"stargazers_count":31,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-24T23:04:18.743Z","etag":null,"topics":["bigdecimal","decimal","ocaml"],"latest_commit_sha":null,"homepage":"https://yawaramin.github.io/ocaml-decimal/","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yawaramin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES","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}},"created_at":"2020-11-09T20:40:46.000Z","updated_at":"2025-01-15T01:07:57.000Z","dependencies_parsed_at":"2024-01-06T02:03:11.969Z","dependency_job_id":"2de62081-d66e-48c8-96af-0c42c119017b","html_url":"https://github.com/yawaramin/ocaml-decimal","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yawaramin%2Focaml-decimal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yawaramin%2Focaml-decimal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yawaramin%2Focaml-decimal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yawaramin%2Focaml-decimal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yawaramin","download_url":"https://codeload.github.com/yawaramin/ocaml-decimal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252062713,"owners_count":21688587,"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":["bigdecimal","decimal","ocaml"],"created_at":"2024-08-03T01:02:53.947Z","updated_at":"2025-05-02T15:30:48.588Z","avatar_url":"https://github.com/yawaramin.png","language":"OCaml","funding_links":[],"categories":["OCaml"],"sub_categories":[],"readme":"## decimal\n\nArbitrary-precision floating-point decimal type implemented in OCaml. Ported\nfrom Python\n[`decimal` module](https://github.com/python/cpython/blob/23831a7a90956e38b7d70304bb6afe30d37936de/Lib/_pydecimal.py).\nIt uses Zarith to do biginteger arithmetic.\n\nOpam: https://ocaml.org/p/decimal\n\n## License\n\nThis package is licensed under the\n[Python Software Foundation License v2](https://github.com/python/cpython/blob/23831a7a90956e38b7d70304bb6afe30d37936de/LICENSE#L73),\nfor the sake of simplicity, as it is a derived work of the Python `decimal` module.\n\n## Examples\n\nSee next section (below) for `dune` instructions.\n\n    $ opam install decimal # if trying out\n    # (* if trying out: *)\n      #require \"decimal\";;\n      #require \"ppx_decimal\";;\n    # (* tell the REPL how to display decimals *)\n      #install_printer Decimal.pp;;\n    # (* PPX gives convenience literal syntax *)\n      Decimal.(0.1m + 0.2m);;\n    - : Decimal.t = 0.3\n    # (* default precision is 32 *)\n      Decimal.(of_int 1 / of_int 3);;\n    - : Decimal.t = 0.33333333333333333333333333333333\n    # (* round to decimal places: *)\n      Decimal.(round ~n:2 (of_int 22 / of_int 7));;\n    - : Decimal.t = 3.14\n\n## Use with dune\n\nIn your `dune` file's `executable` or similar stanza:\n\n```\n (libraries decimal)\n (preprocess (pps ppx_decimal))\n```\n\n## Dev\n\nBuild:\n\n    dune build\n\nTry in REPL:\n\n    dune utop\n\n## Tests\n\nThe test runner source is in `test/decimal_test.ml`. It parses and runs the test\ncases in `test/data/`. I am adding test case data files from the\n[Python snapshot](https://github.com/python/cpython/tree/23831a7a90956e38b7d70304bb6afe30d37936de/Lib/test/decimaltestdata)\nas I go.\n\nRun current tests:\n\n    dune test\n\nNote that, some of the tests don't make sense for the OCaml port and have thus\nbeen deleted. If you ever need to update to new versions of the test files, you\ncan apply the changes as patches after re-dowloading the relevant `*.decTest`\nfiles:\n\n    git show 07074859567e936b8d170aba5ef58889a4d9d467 | git apply\n    git show ae0196377fb7a99db7f198f2fb242e6a2fe4541e | git apply\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyawaramin%2Focaml-decimal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyawaramin%2Focaml-decimal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyawaramin%2Focaml-decimal/lists"}