added cos and sin divide by zero tests