diff options
author | tlatorre <tlatorre@uchicago.edu> | 2018-10-19 10:58:52 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2018-10-19 10:58:52 -0500 |
commit | 4d8a6e3b8f982c947439958b1d22154012376b76 (patch) | |
tree | ac5d8f7ebbed6dcd0fcc74654d488cc4713961f4 /src | |
parent | 491c6fc921dbb42b83986db7c8577030827a856b (diff) | |
download | sddm-4d8a6e3b8f982c947439958b1d22154012376b76.tar.gz sddm-4d8a6e3b8f982c947439958b1d22154012376b76.tar.bz2 sddm-4d8a6e3b8f982c947439958b1d22154012376b76.zip |
speed up sin_theta calculation by replacing sin(acos(cos_theta)) with sqrt(1-pow(cos_theta,2))
Diffstat (limited to 'src')
-rw-r--r-- | src/scattering.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/scattering.c b/src/scattering.c index 0247c62..c4bdd57 100644 --- a/src/scattering.c +++ b/src/scattering.c @@ -158,7 +158,7 @@ double get_probability(double beta, double cos_theta, double theta0) /* Technically this isn't defined up to a sign, but it doesn't matter since * we are going to square it everywhere. */ - sin_theta = fabs(sin(acos(cos_theta))); + sin_theta = sqrt(1-pow(cos_theta,2)); return gsl_spline2d_eval(spline, beta*cos_theta, beta*sin_theta*theta0, xacc, yacc)/(theta0*sin_theta); } |