Added preconditions to arithmetic functions and tested them