Eighth Assignment, due 26th November 2002

Supercalculator

Electronic Submission, hw8

 
Remembering how to use the CGI interface from the first and second homeworks, extend your factorial calculator (from homework 7) into a program that can perform addition, subtraction, multiplication, to-the-power-ofing, and factorial calculations on really big numbers (possibly up to thousands of digits long).

Make a nice CGI interface so that your program can be conveniently run over the web whenever you need extremely accurate calculations.

Be sensible about your test cases. For example, you know that the factorial of 1000 has over 1000 digits, so you should obviously not try to calculate the factorial of a 100 digit number. Similarly, to-the-power-of produces very big numbers. You should not expect to be able to calculate one million to the power of one million.

Here is a sample program that does the kind of thing I am looking for. You can use it to test your results if you like.

Apologies: The version of this program that appeared here until Wednesday 20-11-2002 was an old version that only works for numbers of up to 1000 digits, so it can't correctly calculate the factorial of 1000 for testing the previous homework. That was an oversight on my part, and it has now been replaced by one with enough capacity to calculate the factorial of 1000.


Extra Credit: Division is much harder to do than any of the other operations. Once you have got the required parts working properly, you may attempt division for extra credit.


Extra Extra Credit: If you've really got time on your hands, make it work for floating point numbers with a huge number of digits too.