I've found some strange behaviour when testing this class:
- given two CBigInt from two char, containing both "12345678901234567890", and adding them together, gives me (when using Format()) the char "2469135782469135780" instead of "24691357802469135780" (note that the middle '0' is missing)
- given two CBigInt from two char, containing both "1000000010", the result of adding them is "200000002"
instead of "2000000020".
I was working on Vc5 on Windows 2000.
If you need the code I used to test it, feel free to contact.
This library would be great were it not for the apparent memory leak. By simply instantiating a CBigInt object, either using CBigInt bb or CBigInt aa("123234345"), one can detect a memory leak from a console app using the #include <crtdbg.h> and _CrtDumpMemoryLeaks(); within the main() function.
Any idea how one might fix this? Thanks for sharing.
Nice peace of work! I only have one question: Could you explain the parameters of the format functions? I understand what the 'Radix' does, but what about 'char *szBuf', 'unsigned long cbBuf' and 'unsigned long *pNeeded'?