convert to integers before adding to prevent float rounding errors. issue #16