Performance analysis of threshold neurons with discrete weights