In Russian   IMach   Priest - portal of dialogue and creativity   Author  

   E-mail  Last modified - Dec 28, 2016

C++ class for integers of unlimited range

C++ class  cBigNumber  implements integers of unlimited range. Click to enlarge
The class provides for all regular operations of language C++, including arithmetic, logic and bitwise operations, operations of comparison, shift operations, and also stream input-output with all of integer modifiers. Extra functions - power, power by module, square root and Miller strong probable primality test.
The class uses fast algorithms, such as the binary exponentiation, optimized for numbers containing from 500 to 100,000 bits and more. More large numbers can also be used; the exponentiation tests were carried out for numbers containing up to 12,000,000 bits.

The class has reenterable code to support development of multithreaded applications.
Test environments: Microsoft Visual C++ 6.0, 2002-2015, Borland C++ 3.1 (16 bit), 4.5, Builder 1.0, GNU g++ 2.9.6, 3.3.3 (ARM), 4.1.2 (64 bit), 4.2.3.
Performance of the classnew
The programmer's manual and change listnew

Version 2.1 beta internal of Dec 28, 2016new (fast intrinsic-based multiplication and operations with 64-bit divider/module)
Version 2.0a public of Jul 29, 2016 (asm code with MULX instruction)
The preceding version:  2.0 public of Nov 20, 2010, documentation updated Jan 16, 2015 (64 bit C/asm code for Visual C++/g++)
The preceding 32-bit versions:  1.2c public of Mar 30, 2011 (reenterable)  1.2b public of Nov 19, 2009, updated Nov 20, 2010 (g++)
The preceding beta versions:  1.2a beta public of Sep 22, 2007  1.2 beta public of Jun 15, 2007  1.1a beta public of Nov 26, 2005
Assembler add-on for Visual/Borland C++ and g++ with faster multiplication and division is available by request.
Donations: You must not pay for class cBigNumber. If you have decided to support its development - just transfer funds to one of the following WebMoney purses: R717244026810, Z995907015597, E482829916444, U253542011720, B148113950490. Amount is for choice of your own. Please, show purpose of transfer as "cBigNumber". The transfer is accepted as voluntary donation, funds of which are directed to development and testing of the class. Donation may be conditioned by implementation of additional functions by agreement.
Forum: Consultations (rus)
  • To subscribe to the mailing list 
  • click here and send message.
  • To cancel mailing subscription 
  • click here and send message.
  • To write a letter to the author 
  • click here.
    Though it is not required, you are strongly encouraged to subscribe to the mailing list. The mailing list is intended for delivering of announcements concerning new versions of this software and bug warnings. The author confirms that your email address will never be used for any other purposes and will not be delivered to third persons.

    Paper for Programming and Computer Software 1/2010 (rus)   English translation, ShpringerLink  
    Paper for Program Products and Systems 1/2009 (rus)   DOC file  
    Paper for SIBERCRYPT'05 (rus)   DOC file   Abstract (eng)   DOC file (eng)  

    Links:  C++ template of dynamic arrays with automatic check of an index
    Big Natural Numbers (rus)   The Prime Page   Miller strong probable prime test