Neural network weights are subject to errors caused by technological tolerances when implemented in digital or analog hardware. Since these random variations are unavoidable and unpredictable, they can seriously affect the expected performances. This work proposes a learning algorithm that takes weight tolerances into account and guarantees a low sensitivity to them. Some experimental results show the validity of the suggested approach.