how to round nearest gram

if the fractional part is at least 0.5, round up

if under 0.5, round down