Calculating fraction of a quantity