nan_to_inf temporarily sets 0 values to inf as well