Implementation of arithmetic functions using threshold (neural) circuits