replacing all occurrences of DBL_MAX