Optimization of functions whose values are subject to small errors