Skip to content

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