http://www.cs.cornell.edu/Info/Courses/Current/CS100B/prog4.html CS100B Program 4 Solution

CS100B Program 4

Solution


I decided to implement my bigint as
#define DIGITS 512

typedef struct {
   unsigned short array[DIGITS];
   int digits;
   } bigint;
I will keep the least significant digit in index 0, and the most significant digit in (digits-1).

The implementation of my bigint library.

The Sterling's approximation code. Many programs I saw used two loops to determine n!. This was very inefficient; you only need one loop.