Ive tried the test program and found when multiplying the two input numbers (a x b) the bit size seems to be limited to 50 bits, and when forming the factorial it's limited to 150 bits. Perhaps I've missed something in the implementation, but i just used the filed from Sourceforge and rand the test program with a few numbers. Thanks for any suggestions, Neil
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Again thank you for the help. A couple of days ago i downloaded what i though was the most recent version, but looking in the file header it did say February 2011.
However, from your above link i downloaded the files from version 5.0 bigInt.f, bigInt.cpp and main.cpp. They compiled without errors, but on running the code i get several thousand lines of hex data with TURE and FALSE words dotted around, then ending with the statement:
RUN FAILED (exit value 1, total time: 4s)
Somehow i don't think this is quite how it should be.
Cheers,
neil
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ive tried the test program and found when multiplying the two input numbers (a x b) the bit size seems to be limited to 50 bits, and when forming the factorial it's limited to 150 bits. Perhaps I've missed something in the implementation, but i just used the filed from Sourceforge and rand the test program with a few numbers. Thanks for any suggestions, Neil
Hi,
Could you send your test?
Alex
Thanks for your rapid response.
From your good code i have:
int
main(int argc, char** argv) {
BigInt a("-99999999"), b(10000000), c;
c = a * b;
cout << endl << a << " * " << b << " = " << c << endl;
c = a % b;
cout << endl << a << " % " << b << " = " << c << endl;
string s = "39";
c = BigInt::factorial(s);
cout << endl << s << " !" << " = " << c << endl;
return 0;
}
which generates the output:
-99999999 * 10000000 = 99999990000000
-99999999 % 10000000 = -9999999
39 ! = 2606625904899470449481415313618422988800000000
RUN SUCCESSFUL (total time: 130ms)
which is great.
However, when i increase a by an extra character '9' as in:
BigInt a("-999999999"), b(10000000), c;
i get:
RUN FAILED (exit value -1,073,741,819, total time: 5s)
and when i increase the factorial number by one, as in:
string s = "40";
i get:
-99999999 * 10000000 = 99999990000000
-99999999 % 10000000 = -9999999
40 ! = 0
RUN SUCCESSFUL (total time: 120ms)
But factorial 40 isn't zero, so something amiss somewhere.
many thanks for any help,
neil
Hi,
Compilation of your main() failed on my compiler (g++ version 4.9.2).
error: no matching function for call to ‘BigInt::BigInt(const char [10])’
BigInt a("-99999999"), b(10000000), c;
error: ‘factorial’ is not a member of ‘BigInt’
c = BigInt::factorial(s);
Which version of C++ BigInt are you using?
Latest version is 5.0.
https://sourceforge.net/projects/cpp-bigint/files/C%2B%2B%20BigInt%20Class/Version%205.0/
Which compiler are you using?
Last edit: Alex Vinokur 2015-04-17
Again thank you for the help. A couple of days ago i downloaded what i though was the most recent version, but looking in the file header it did say February 2011.
However, from your above link i downloaded the files from version 5.0 bigInt.f, bigInt.cpp and main.cpp. They compiled without errors, but on running the code i get several thousand lines of hex data with TURE and FALSE words dotted around, then ending with the statement:
RUN FAILED (exit value 1, total time: 4s)
Somehow i don't think this is quite how it should be.
Cheers,
neil
‘factorial’ is not a member of ‘BigInt’
How can it be compiled?
My C++ BigInt doesn't print RUN FAILED or RUN SUCCESSFUL