Added checking for trig function domain errors