Arithmetic optimization