You can use an alternate formula for the large values:
T = (1 + 1./exp(x)) ./ (1 - 1./exp(x))
Note that once x gets large enough (19), the ratio calculation becomes equivalent to the "first order" approximation 1 + 2/exp(x) because of the limits of double precision arithmetic.