Computes the binomial probability mass function (PMF) directly with extended floating point types (e.g. Fp!128), which provides additional accuracy for large values of k, n, or p.
value to evaluate PMF (e.g. number of "heads")
number of trials
true probability
fp_binomialPMF provides accurate values for large values of n
import mir.bignum.fp: Fp, fp_log; import mir.math.common: approxEqual; assert(1.fp_binomialPMF(1_000_000, Fp!128(0.75)).fp_log!double.approxEqual(binomialLPMF(1, 1_000_000, 0.75)));
Binomial Distribution
See Implementation
Computes the binomial probability mass function (PMF) directly with extended floating point types (e.g. Fp!128), which provides additional accuracy for large values of k, n, or p.