Deal with relative values in the presence of NaN and negative values