EDIT: This has been solved.
The reflection coefficient of light approaching glass with an incidence angle $\theta_i$ varies with $$f_R=\frac{\tan(\theta_i-\theta_r)}{\sin(\theta_i+\theta_r)}$$ where $\theta_i$ and $\theta_r$ are related by $$\sin(\theta_i)=n\sin(\theta_r)$$ where $n$ is the glass's index of refraction.
Plotting $f_R$ as a function of $\theta_i$ (and assuming say $n=2$) we get the following:
Clearly the expression has a well-defined limit at $\theta_i=0$ despite not being defined there due to the denominator. Is it possible to re-work the expression for $f_R$ so that it doesn't run into numerical problems near $\theta_i=0$?
EDIT:
I initially know $\cos(\theta_i)$ and from there use trigonometric identities to calculate the rest. I would like to avoid evaluating trigonometric functions (or their inverses), and therefore the expression shouldn't feature $\theta_i$ or $\theta_r$ except as terms within the argument to a trigonometric function.
