Why am I getting strange results with simple arithmetic operations?