The OpenD Programming Language

bernoulliCDF

Computes the bernoulli cumulatve distribution function (CDF).

@safe pure nothrow @nogc
T
bernoulliCDF
(
T
)
(
const bool x
,
const T p
)
if (
isFloatingPoint!T
)

Parameters

x bool

value to evaluate CDF

p T

true probability

Examples

import mir.math.common: approxEqual;

assert(true.bernoulliCDF(0.5) == 1);
assert(false.bernoulliCDF(0.5) == 0.5);

assert(true.bernoulliCDF(0.7) == 1);
assert(false.bernoulliCDF(0.7).approxEqual(0.3));

See Also

Meta