{"id":18873558,"url":"https://github.com/bartekleon/bigintcpp","last_synced_at":"2026-02-16T13:30:17.388Z","repository":{"id":54847114,"uuid":"263178162","full_name":"bartekleon/BigintCPP","owner":"bartekleon","description":"Bigint class provides math operations for arbitrarily large numbers.","archived":false,"fork":false,"pushed_at":"2021-01-26T01:05:16.000Z","size":1177,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-31T00:42:35.387Z","etag":null,"topics":["bigint","biginteger-cpp","cplusplus","cpp","cpp17","library"],"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/bartekleon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-11T23:03:16.000Z","updated_at":"2021-01-13T22:09:29.000Z","dependencies_parsed_at":"2022-08-14T04:40:27.491Z","dependency_job_id":null,"html_url":"https://github.com/bartekleon/BigintCPP","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartekleon%2FBigintCPP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartekleon%2FBigintCPP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartekleon%2FBigintCPP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartekleon%2FBigintCPP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bartekleon","download_url":"https://codeload.github.com/bartekleon/BigintCPP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239825010,"owners_count":19703199,"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","biginteger-cpp","cplusplus","cpp","cpp17","library"],"created_at":"2024-11-08T05:35:16.642Z","updated_at":"2026-02-16T13:30:17.339Z","avatar_url":"https://github.com/bartekleon.png","language":"C++","readme":"[![Build Status](https://travis-ci.com/kmdrGroch/BigintCPP.svg?branch=master)](https://travis-ci.com/kmdrGroch/BigintCPP) [![codecov](https://codecov.io/gh/kmdrGroch/BigintCPP/branch/master/graph/badge.svg)](https://codecov.io/gh/kmdrGroch/BigintCPP)\n\n[Requirements](#requirements)\n[Description](#description)\n\n[Operators](#operators)\n\n*  [Addition](#addition)\n*  [Subtraction](#subtraction)\n*  [Unary minus](#unary-minus)\n*  [Multiplication](#multiplication)\n*  [Division](#division)\n*  [Modulo](#modulo)\n*  [Allocation](#allocation)\n*  [Comparison](#comparison)\n*  [Access](#access)\n*  [Stream operators](#stream-operators)\n\n[Methods](#methods)\n\n*  [pow](#powint)\n*  [clear](#clear)\n*  [abs](#abs)\n*  [digits](#digits)\n*  [is_even](#is_even)\n*  [is_negative](#is_negative)\n*  [to_string](#to_string)\n*  [clone](#clone)\n*  [add_zeroes](#add_zeroes)\n*  [remove_trailing](#remove_trailing)\n\n[Functions](#functions)\n\n*  [toString](#tostringbigint)\n\n# Requirements\n\nTo build this project you need: CMake, make, gcc/clang.\nAlso build.sh requires you to have installed and in path: clang-format, clang-tidy\n\nFor testing you need additionally lcov with it's tools: geninfo and gcov.\n\n# Description\n\nBigint class provides math operations for arbitrarily large numbers.\n\n# Operators\n\n## Addition\n```C++\nBigint a, b, c;\nc = a + b;\nc += a;\nc = a + 6;\nc += 6;\n```\n\n## Subtraction\n```C++\nBigint a, b, c;\nc = a - b;\nc -= a;\n```\n\n## Unary minus\n```C++\ncout \u003c\u003c -Bigint(10) // -10\n```\n\n## Multiplication\n```C++\nBigint a, b, c;\nc = a * b;\nc *= a\nc = a * 6;\nc *= 6;\n```\n\n## Division\n```C++\nBigint a, b;\nBigint c;\nc = a / b;\n```\n\n## Modulo\n```C++\nBigint a;\nint b;\nb = a % 31415;\n```\n\n## Comparison\n```C++\nBigint a = 159753;\nBigint 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\n## Allocation\n```C++\nBigint a = 12345;\nBigint b;\nb = 159753;\nBigint c = \"12345\";\nBigint d = b;\nBigint e;\ne = \"23498523524\";\n```\n\n## Access\n```C++\nBigint a = 159753;\na.pow(15); //a^15, 1126510743106482...\ncout \u003c\u003c a[3]; // 6 is the 4th digit from the left\n\nBigint b = 123456789;\ncout \u003c\u003c b(2); // 7 is the 3th digit from the right\n```\n\n## Stream operators\n```C++\nBigint a, b;\ncin \u003e\u003e a \u003e\u003e b;\ncout \u003c\u003c a * b;\n```\n\n# Methods\n\n## clear()\nClears the Bigint, making it equal to 0.\n```C++\nBigint a = 4558;\ncout \u003c\u003c a.pow(486); // ~1.46 * 10^1778\na.clear();\ncout \u003c\u003c a; // 0\n```\n\n## abs()\nAbsolute value.\n```C++\nBigint a = -4558;\ncout \u003c\u003c a.abs() // 4558\n```\n\n## pow(int)\nRaises to the power of N.\n```C++\nBigint a = 4558;\ncout \u003c\u003c a.pow(486); // ~1.46 * 10^1778\n```\n\n## digits()\nReturns the number of digits.\n```C++\nBigint a = 4558;\ncout \u003c\u003c a.pow(486).digits(); // 4558^486 = 1779 digit number\n```\n\n## is_even()\nReturns true is the number is even.\n```C++\nBigint a = 4558;\ncout \u003c\u003c a.isEven(); // true\n```\n\n## is_negative()\nReturns true is the number is negative.\n```C++\nBigint a = -4558;\ncout \u003c\u003c a.isNegative(); // true\n```\n\n## to_string()\nConverts the big integer to a string.\n```C++\nstring str;\nBigint a = 455897864531248;\nstr = a.toString();\n```\n\n## clone()\nClones Bigint with the same value\n```C++\nBigint a = 455897864531248;\nBigint b = a.clone();\ncout \u003c\u003c a == b // true\n```\n\n## add_zeroes()\nMultiplies number by pow(10, n) - faster than a*10^n\n```C++\nBigint a = 455897864531248;\na.addZeroes(4);\ncout \u003c\u003c a // 4558978645312480000\ncout \u003c\u003c a.addZeroes(3) // 4558978645312480000000\n```\n\n## remove_trailing()\nDivides number by pow(10, n) - faster than a/10^n\n```C++\nBigint a = 3433123100000;\na.remove_trailing(4);\ncout \u003c\u003c a // 34331231\n\nBigint b = \"3433123156364113314123\"\ncout \u003c\u003c a.remove_trailing(11) // 34331231563\n```\n\n# Functions\n\n## to_string(Bigint)\nConverts the big integer to a string.\n```C++\nstring str;\nBigint a = 455897864531248;\nstr = toString(a);\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartekleon%2Fbigintcpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbartekleon%2Fbigintcpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartekleon%2Fbigintcpp/lists"}