Minor improvement to efficiency in calculate.c (reduce number of additions)