BigInt for C++

Правка en14, от Arpa, 2022-07-08 18:42:55

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 , lcm , abs.

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

  • It can cast data to long long, string.

  • It uses fast multiplication.

source.(but I have edited that and added pow and size().)

UPD1 (September 2016): Bug in void operator=(long long v) is now fixed. Thanks to amsen.

Теги bignum, bignumber, c++

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en14 Английский Arpa 2022-07-08 18:42:55 8 Tiny change: 'aster/cpp/bigint.cp' -> 'aster/cpp/numeric/bigint.cp'
en13 Английский Arpa 2016-09-12 21:25:35 2 Tiny change: ' 2016):** bug in `voi' -> ' 2016):** Bug in `voi'
en12 Английский Arpa 2016-09-12 21:19:51 116 Tiny change: '\n**UPD1 (september 2016)** bug in ' -> '\n**UPD1 (September 2016):** bug in '
en11 Английский 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 Английский Arpa 2016-01-03 21:37:07 2 Tiny change: 'gcd` , `lcp` , `abs`.' -> 'gcd` , `lcm` , `abs`.'
en9 Английский 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 Английский Arpa 2016-01-03 18:13:01 0 (published)
en7 Английский Arpa 2016-01-03 18:12:20 205
en6 Английский Arpa 2016-01-03 15:40:29 8 Tiny change: ' bignum I ever have seen: [Li' -> ' bignum I have ever seen: [Li'
en5 Английский Arpa 2016-01-03 14:49:51 5
en4 Английский Arpa 2016-01-03 14:49:23 12
en3 Английский Arpa 2016-01-03 14:48:39 36
en2 Английский Arpa 2016-01-03 14:46:58 7 Tiny change: 'oblems is saving integers ' -> 'oblems is to save integers '
en1 Английский Arpa 2016-01-03 14:46:28 479 Initial revision (saved to drafts)