I was wondering if there is some mathematical approximation for calculating the ratios of factorials. I don't mean a shortcut to deriving the factorial results through a means like Stirling's Formula, but of bypassing the factorial calculations altogether when the final ratio would actually turn out to be a small number. The reason I'm asking is that I occasionally run into manifestations of this problem when teaching myself to convert statistical and data mining equations into T-SQL code, where the highest precision float data types can only go up to about a 135! or so before triggering arithmetic overflows. The final product of these ratios, however, is often much smaller even when very high values are plugged in, and would fit comfortably within the range of the data types I'm using. For example, 200! is beyond the range of our data types. But if you plug it into the equation N! / (N -1)! it would return 0.0049751243781094527363184079602, which fits easily. What I need is some general-purpose method for reaching the same answer (or something close to it) without using factorials as either the divisor or dividend. Approximations would be acceptable.
I'm also running into a similar issue when nearly infinitesimal decimal points are tacked onto the end of divisors. For example, I found it difficult to code the Hosmer-Lemeshow Test because the final test statistic often involves computations like this: 1 / (1 + some number like 0.1-E50). When the two parts of the divisor are added together, the infinitesimal part is rounded off in almost all computer languages I've heard of. Like the factorial ratios, the final product would fit easily within most high-precision data types, but cannot be reached through the standard equation. Is there a means of approximating these type of equations as well (or even of factoring them by splitting the divisor somehow?).
Thanks for any help in advance. In order to avoid duplicating any existing questions I tried to do some searches across the Internet and in CrossValidated on this issue over the last month or so on both, but may be using the wrong search terms, because I'm coming up empty. I figured CrossValidated would be the right forum, since I'm encountering these issues from time to time with various statistical and data mining algorithms, most recently the Hosmer-Lemeshow Test.