The OpenD Programming Language

fp_binomialPMF

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.

@safe pure nothrow @nogc
T
fp_binomialPMF
(
T
)
(
const size_t k
,
const size_t n
,
const T p
)
if (
is(T == Fp!size,
size_t size
)
)

Parameters

k size_t

value to evaluate PMF (e.g. number of "heads")

n size_t

number of trials

p T

true probability

Examples

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)));

See Also

Meta