Implement nans and infs