corrected get_density_or_frac to double