handle positive and negative infinity in trigonometry functions