Return nan for tan and cot at infinity