I am trying to solve for probabilities in systems with a large number of elements. To deal with the large factorials that appear in these formulas, I use Stirling's formula, lnm!=mlnm-m+(1/2)ln(2πm). My problem is that after I get the approximation and try to plug it into the probability formula, N!/(n!(N-n)!)(p^n)(q^(N-n)), I get overflows on my calculator. How can I get around this? Here is an example problem: Using Stirling's formula, calculate the probability of getting exactly 500 heads and 500 tails when flipping 1000 coins. The probability equation looks like: (1000!/(2!998!))(1/2)^2(1/2)^998 I used lnm!=mlnm-m+(1/2)ln(2πm) to get: ln998!=5898.3 and ln1000!=5912.2 I wound up with somehting that looked like this: (e^5912.2/2e^5898.3)(1/2)^2(1/2)^998 How do I get my calculate to work with these kind of numbers?? Thanks for any help!!