Inf values in the input vector will survive rescaling, causing an infinite loop. The value of 1000 is arbitrarily chosen as a large but finite value with the intention to never interfere with regular calculations.
Based on 3.4.2 version, apply patch.for_lapack-3.4.2.