Skip to content

C++ header-only implementation of arbitrary-length integers.

License

Notifications You must be signed in to change notification settings

FaresBadrCA/bigint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🔢 bigint 🔢

A header-only C++ implementation of arbitrary-length integers. It is meant to provide a balance between ease of use and performance.

If you need maximum performance, use GMP instead (https://gmplib.org/).

🔧 Usage 🔧

#include "bigint.h"

int main() {
    bigint a, b;
    std::cin >> a >> b;
    bigint c = a * b;

    std::cout << (c >= 100 && c < 1000) << '\n';
    c += a;
    c *= 1000;
    c /= b;
    c %= 500000;
    int64_t d = static_cast<int64_t> c;
    std::cout << c << '\n';
}

📋 ToDo List 📋

✅ Addition / Subtraction / Multiplication / Division / Modulo
✅ Relational Operators (==, !=, <, >, <=, >=)
✅ Mixed-type operations (bigint + int, etc...)
❌ Tests and benchmarks
❌ Base 2^32 or 2^64 representation
❌ Karatsuba multiplication
❌ Newton-Raphson division

📚 Other large integer libraries 📚

About

C++ header-only implementation of arbitrary-length integers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages