sum[Double] is equivalent to the old code.