diff options
Diffstat (limited to 'mathfuncs_asin.h')
-rw-r--r-- | mathfuncs_asin.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/mathfuncs_asin.h b/mathfuncs_asin.h index ce15fe9..3dd9c75 100644 --- a/mathfuncs_asin.h +++ b/mathfuncs_asin.h @@ -181,16 +181,22 @@ namespace vecmathlib { template<typename realvec_t> realvec_t mathfuncs<realvec_t>::vml_atan2(realvec_t y, realvec_t x) { + // Algorithm taken from SLEEF 2.80 + realvec_t r = atan2k(fabs(y), x); r = mulsign(r, x); r = ifthen(isinf(x) || x == RV(0.0), - ifthen(isinf(x), RV(M_PI_2) - copysign(RV(M_PI_2), x), RV(M_PI_2)), + ifthen(isinf(x), + RV(M_PI_2) - copysign(RV(M_PI_2), x), + RV(M_PI_2)), r); r = ifthen(isinf(y), - ifthen(isinf(x), RV(M_PI_2) - copysign(RV(M_PI_4), x), RV(M_PI_2)), + ifthen(isinf(x), + RV(M_PI_2) - copysign(RV(M_PI_4), x), + RV(M_PI_2)), r); r = ifthen(y == RV(0.0), |