Threshold function (source code)

= Threshold function
{wiki}

= Threshold Boolean function
{c}
{synonym}

A threshold Boolean function outputs one exactly when a weighted sum of its input bits reaches a specified threshold. The unweighted threshold function $f_{n,r}$ tests whether at least $r$ of its $n$ inputs are one.