handle negative number and divide by zero