cache residuals with check, add INFINITY macro if not defined