Skip to content

rendon/integer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Integer

My naive Big Integer class. I implemented this class some time ago in order to solve problems in programming contests since C/C++ doesn't have native support for these operations.

For practical pursposes its better to use a more reliable and faster libraries, such as GNU MP or Java BigInteger class, but if you want to understand how the things work(essencial in programming contests) this class can be useful to you.

My implementation is slow but I've tried to make the code as understandable as possible, in contrast with the other faster libraries.

Operations supported

  • addition: + operator
  • subtraction: - operator
  • multiplication: * operator
  • division: / operator
  • modulo: % operator
  • exponentiation
  • modular exponentiation
  • gcd()
  • lcm()
  • bit shifting: operators <<, >>
  • Some others.

Tests

In test.cpp there are some tests for each operation that I've prepared using UnitTest++. Also, there is a test generator written in Ruby and a small bash script to automate the tests.

NOTES

About

Big Integer class.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published