Binary entropy (source code)

= Binary entropy

The binary entropy function is
$$
h_2(p)=-p\log_2p-(1-p)\log_2(1-p).
$$