arithmetic error function and stoping when receiving wrong parameters