Skip to content

A C++ class for variable size integers. Useful if you need big integers in your code. Made of only 2 files and offers very high performances.

License

Notifications You must be signed in to change notification settings

Bapt5962/variable-size-int

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Variable size int

A C++ class for variable size integers. Useful if you need big integers in your code. Made of only 2 files and offers very high performances.

The class consists only of vint.h and vint.cpp. It is not necessary to download main.cpp, test_vint.cpp and test_vint.hpp unless you want to run the unit tests and performance tests.

Documentation and some configuration can be found in vint.h.

High performances are achieved by using base 2^64 (and especially not base 10 strings) and fast algorithms.

This class does not claim to be the most performant library for big integers, for the highest performances possible, see (https://gmplib.org/). The main reason for making this was because I was bored.

Possible future improvements

  • Add faster algorithms for multiplication. Currently, only the Karatsuba algorithm is available but faster algorithms exists when the integers are large enough.
  • Use the Lehmer's GCD algorithm for the GCD. Currently, only the Binary GCD algorithm is available.
  • Clean up the division algorithm as it's current implementation probably does much more memory allocations than needed.

About

A C++ class for variable size integers. Useful if you need big integers in your code. Made of only 2 files and offers very high performances.

Topics

Resources

License

Stars

Watchers

Forks

Languages