I have the need to evaluate equations of the form
$$\binom{n}{x} p^a (1-p)^b$$
where the values of $p$ are between 0 and 1 and $n$, $x$, $a$, and $b$ can be very large numbers.
I attempt to use
parms = {n -> 200, x -> 103, a -> 105, b -> 98};
e = Exp[LogGamma[n + 1] - LogGamma[x + 1] - LogGamma[n - x + 1] + a Log[p] + b Log[1 - p]] /. parms
but this gets converted back to
82791133891761429477050485625917802548514807100408460044000 (1 - p)^98 p^105
I was thinking that the interior of Exp[...] would get evaluated first but that doesn't happen. When I need to plug in certain values for $p$ I can get underflow errors. For example,
e /. p -> 0.001
results in
How can I evaluate such constructions without getting underflow errors?

Expdoesn't evaluate until you want it to is to use anInactive[Exp]instead:e = Inactive[Exp][LogGamma[n + 1] - LogGamma[x + 1] - LogGamma[n - x + 1] + a Log[p] + b Log[1 - p]] /. parms. ThenActivate[e /. p -> 0.001]seems to work! – thorimur Nov 25 '21 at 05:50p, e.g.,e /. p -> 0.001\10` – Bob Hanlon Nov 25 '21 at 06:17p->1/1000. Then you can applyN. – Bill Watts Nov 25 '21 at 07:20e[n_, x_, a_, b_][p_] := Exp[LogGamma[n + 1] - LogGamma[x + 1] - LogGamma[n - x + 1] + a Log[p] + b Log[1 - p]]and thene[200, 103, 105, 98][0.001]gives 7.50588e-257. – evanb Nov 25 '21 at 10:14