{"id":20903512,"url":"https://github.com/jedbrooke/fractionalbignum","last_synced_at":"2026-05-18T13:33:41.365Z","repository":{"id":110784533,"uuid":"466883690","full_name":"jedbrooke/fractionalBignum","owner":"jedbrooke","description":"bignum library for representing numbers between 0 and 1 with higher than 64 bits of precision","archived":false,"fork":false,"pushed_at":"2024-05-07T05:08:47.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-19T13:50:05.959Z","etag":null,"topics":["cpp"],"latest_commit_sha":null,"homepage":"","language":"C++","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/jedbrooke.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":"2022-03-06T23:36:08.000Z","updated_at":"2024-05-07T05:08:51.000Z","dependencies_parsed_at":"2024-02-13T09:30:54.048Z","dependency_job_id":null,"html_url":"https://github.com/jedbrooke/fractionalBignum","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jedbrooke%2FfractionalBignum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jedbrooke%2FfractionalBignum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jedbrooke%2FfractionalBignum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jedbrooke%2FfractionalBignum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jedbrooke","download_url":"https://codeload.github.com/jedbrooke/fractionalBignum/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243293795,"owners_count":20268142,"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":["cpp"],"created_at":"2024-11-18T13:13:51.996Z","updated_at":"2025-12-27T17:25:48.923Z","avatar_url":"https://github.com/jedbrooke.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fractionalBignum\nbignum library for representing numbers between 0 and 1 with higher than 64 bit depth\n\nin a normal 64 bit int, the MSB is 2\u003csup\u003e63\u003c/sup\u003e, and the LSB is 2\u003csup\u003e0\u003c/sup\u003e.\n\nIf instead we want to represent fractions in the range of (0,1), we can take a 64 bit int and let the MSB represent 2\u003csup\u003e-1\u003c/sup\u003e\nand the LSB be 2\u003csup\u003e-64\u003c/sup\u003e.\n\nThen, we can chain together mutliple 64bit ints together to extend out LSB to go as far as we want. For example with 4 64bit ints the LSB would represent 2\u003csup\u003e-256\u003c/sup\u003e.\n\nexample usage:\n\nsee [examples/basic_usage.cpp](examples/basic_usage.cpp) for full code.\n\naddition example: 2\u003csup\u003e-1\u003c/sup\u003e + 2\u003csup\u003e-65\u003c/sup\u003e\n\n```\n    0.00000000000000000002710505431213761085\n+   0.50000000000000000000000000000000000000\n---------------------------------------------\nas fractionalBignum\n0.50000000000000000002710505431213761085\nas regular double\n0.5\n\n```\n\nspeed comparison[^1]:\n\nsee [examples/speed_comparison.cpp](examples/speed_comparison.cpp) for full code.\n\ncomparison to [gmp](https://gmplib.org/)\n\n```\nfractionalBignum:       0.00000000000000000005421010862427522170331137592055280...\ngmp mpf_t:              0.00000000000000000005421010862427522170331137592055280...\nrunning 1073741824 iterations\nrunning fractionalBignum\n4.31574s\nrunning gmp mpf_t test\n22.4879s\ncheck results:\nfractionalBignum:       0.00000000005820766091346740722971794362088404722181797...\ngmp mpf_t:              0.00000000005820766091346740722971794362088404722181797...\n```\nthe results do not match exactly, but are accurate to 85 decimal places\n\n\nTODO:\n - [ ] basic I/O\n    - [x] printing in hex\n    - [x] printing in base 10[^2]\n    - [x] from double constructor\n    - [ ] base 2/10/16/64 string constructor\n - [ ] basic arithmetic\n    - [x] addition operator\n    - [x] subtraction operator\n    - [x] multiplication operator\n    - [ ] comparision operators\n    - [x] shift operator\n - [ ] additional arithmetic\n    - [x] div(int64, int64) -\u003e fractionalBignum\n    - [ ] karatsuba/fft based multiplication for very large bit counts\n    - [ ] `avx2` vecorization for speedup\n    - [ ] operations with fractionalBignums of mixed sizes\n - [ ] misc\n    - [x] setup proper library packaging\n    - [x] speed comparison to GNU GMP\n    - [ ] tests\n\n[^1]: test system used: intel i5 4950 @3.5ghz 16GB RAM\n\n[^2]: base 10 conversion relies on the cmath `pow` function which is essentially just a `double`, so it breaks around 2^1024.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjedbrooke%2Ffractionalbignum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjedbrooke%2Ffractionalbignum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjedbrooke%2Ffractionalbignum/lists"}