{"id":13729915,"url":"https://github.com/kasparsklavins/bigint","last_synced_at":"2025-05-08T02:30:52.920Z","repository":{"id":24825792,"uuid":"28240340","full_name":"kasparsklavins/bigint","owner":"kasparsklavins","description":"A lightweight big integer library for c++","archived":false,"fork":false,"pushed_at":"2021-08-15T09:25:43.000Z","size":32,"stargazers_count":220,"open_issues_count":21,"forks_count":55,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-11-14T20:38:42.285Z","etag":null,"topics":["bigint","bignum","c-plus-plus"],"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/kasparsklavins.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-19T18:04:33.000Z","updated_at":"2024-09-26T00:57:56.000Z","dependencies_parsed_at":"2022-08-06T05:00:36.495Z","dependency_job_id":null,"html_url":"https://github.com/kasparsklavins/bigint","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasparsklavins%2Fbigint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasparsklavins%2Fbigint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasparsklavins%2Fbigint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasparsklavins%2Fbigint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kasparsklavins","download_url":"https://codeload.github.com/kasparsklavins/bigint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252986626,"owners_count":21836197,"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":["bigint","bignum","c-plus-plus"],"created_at":"2024-08-03T02:01:07.405Z","updated_at":"2025-05-08T02:30:52.663Z","avatar_url":"https://github.com/kasparsklavins.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/kasparsklavins/bigint.svg)](https://travis-ci.org/kasparsklavins/bigint)\n\n* [Description](#description)   \n* [Operators](#operators)\n  * [Addition](#addition)\n  * [Subtraction](#subtraction)\n  * [Multiplication](#multiplication)\n  * [Allocation](#allocation)\n  * [Comparison](#comparison)\n  * [Access](#access)\n  * [Streaming operators](#streaming-operators)\n* [Methods](#methods)\n  * [clear](#clear)\n  * [abs](#abs)\n  * [pow](#powint)\n  * [digits](#digits)\n  * [trailing_zeros](#trailing_zeros)\n* [Functions](#functions)\n  * [abs](#absbigint)\n  * [to_string](#to_stringbigint)\n  * [factorial](#factorialint)\n\n# Description\nBigint class provides math operations for arbitrarily large numbers. You know the limit is reached when your computer freezes.\n\n# Operators\n## Addition\n```C++\nDodecahedron::Bigint a,b,c;\nc = a + b;\nc += a;\nc = a + 6;\nc += 6;\n```\n## Subtraction\n```C++\nDodecahedron::Bigint a,b,c;\nc = a - b;\nc -= a;\n```\n## Multiplication\n```C++\nDodecahedron::Bigint a,b,c;\nc = a * b;\nc *= a;\nc = a * 6;\nc *= 6;\n```\n## Allocation\n```C++\nDodecahedron::Bigint a = 12345;\nDodecahedron::Bigint b;\nb = 159753;\n```\n## Comparison\n```C++\nDodecahedron::Bigint a = 159753;\nDodecahedron::Bigint b = 1634687496;\n\nif(a == b) cout \u003c\u003c \"A is the same as B\";\nif(a \u003c b) cout \u003c\u003c \"A is less than B\";\nif(a \u003e b) cout \u003c\u003c \"A is larger than B\";\nif(a \u003e= b) cout \u003c\u003c \"A is larger than B or equal to it\";\nif(a \u003c= b) cout \u003c\u003c \"A is smaller than B or equal to it\";\n```\n## Access\n```C++\nDodecahedron::Bigint a = 159753;\na.pow(15); //a^15, 1126510743106482...\ncout \u003c\u003c a[3]; // 6 is the 4th digit\n```\n## Stream operators\n```C++\nDodecahedron::Bigint a,b;\ncin \u003e\u003e a \u003e\u003e b;\ncout \u003c\u003c a*b;\n```\n# Methods\n## clear()\nClears the Dodecahedron::Bigint, essentially making it equal to 0.\n```C++\nDodecahedron::Bigint a = 4558;\ncout \u003c\u003c a.pow(486);;  // ~1.46 * 10^1778\na.clear();\ncout \u003c\u003c a; //0\n```\n## abs()\nAbsolute value.\n```C++\nDodecahedron::Bigint a = -4558;\ncout \u003c\u003c a.abs() // 4558\n```\n## pow(int)\nRaises to the power of N.\n```C++\nDodecahedron::Bigint a = 4558;\ncout \u003c\u003c a.pow(486); // ~1.46 * 10^1778\n```\n## digits()\nReturns the number of digits.\n```C++\nDodecahedron::Bigint a = 4558;\ncout \u003c\u003c a.pow(486).digits(); // 4558^486 = 1779 digit number\n```\n## trailing_zeros()\nReturns the number of trailing zeros.\n```C++\nDodecahedron::Bigint a = 4558;\na.pow(486);\ncout \u003c\u003c a.trailing_zeros(); //972\n```\n# Functions\n## abs(Bigint)\nSame as [abs](#abs), but returns a new instance;\n```C++\nDodecahedron::Bigint a = -455897864531248;\ncout \u003c\u003c abs(a) // 455897864531248\n```\n## to_string(Bigint)\nConverts the big integer to a string.\n```C++\nstring str;\nDodecahedron::Bigint a = 455897864531248;\nstr = to_string(a);\n```\n## factorial(int)\nReturns a factorial of an integer, aka n!\n```C++\ncout \u003c\u003c Dodecahedron::factorial(20000); //70`000+ digit number\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkasparsklavins%2Fbigint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkasparsklavins%2Fbigint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkasparsklavins%2Fbigint/lists"}