slightly changing divround scalar algo to avoid integer overflow