BigInt for C++

Revision en7, by Arpa, 2016-01-03 18:12:20

Hi!

One of the C++ programmers problems is to work with integers greater than 2^64-1 (we can save 0to 2^64-1 in unsigned long long int). So I want to share the best Bignum implementation I have ever seen (Link) with CodeForces Community.

Its specifications are as follows:

  • Supported operations: + , -, / , * , % , ^(pow) , gcd , lcp , abs.

  • It is able to work with Standard Input/Output streams.

  • It can cast data to long long, string.

  • It uses fast multiplication.

Tags bignum, bignumber, c++

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en14 English Arpa 2022-07-08 18:42:55 8 Tiny change: 'aster/cpp/bigint.cp' -> 'aster/cpp/numeric/bigint.cp'
en13 English Arpa 2016-09-12 21:25:35 2 Tiny change: ' 2016):** bug in `voi' -> ' 2016):** Bug in `voi'
en12 English Arpa 2016-09-12 21:19:51 116 Tiny change: '\n**UPD1 (september 2016)** bug in ' -> '\n**UPD1 (September 2016):** bug in '
en11 English Arpa 2016-01-14 10:48:22 138 Tiny change: 'gint.cpp).**' -> 'gint.cpp).(but I have edited that and added `pow` and `size()`.)**'
en10 English Arpa 2016-01-03 21:37:07 2 Tiny change: 'gcd` , `lcp` , `abs`.' -> 'gcd` , `lcm` , `abs`.'
en9 English Arpa 2016-01-03 21:30:54 4 Tiny change: 't data to long long, string.\n\n- It ' -> 't data to `long long`, `string`.\n\n- It '
en8 English Arpa 2016-01-03 18:13:01 0 (published)
en7 English Arpa 2016-01-03 18:12:20 205
en6 English Arpa 2016-01-03 15:40:29 8 Tiny change: ' bignum I ever have seen: [Li' -> ' bignum I have ever seen: [Li'
en5 English Arpa 2016-01-03 14:49:51 5
en4 English Arpa 2016-01-03 14:49:23 12
en3 English Arpa 2016-01-03 14:48:39 36
en2 English Arpa 2016-01-03 14:46:58 7 Tiny change: 'oblems is saving integers ' -> 'oblems is to save integers '
en1 English Arpa 2016-01-03 14:46:28 479 Initial revision (saved to drafts)