diff options
Diffstat (limited to 'boost/math/special_functions/erf.hpp')
-rw-r--r-- | boost/math/special_functions/erf.hpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/boost/math/special_functions/erf.hpp b/boost/math/special_functions/erf.hpp index f7f75b0bc7..8d3ee925f4 100644 --- a/boost/math/special_functions/erf.hpp +++ b/boost/math/special_functions/erf.hpp @@ -155,12 +155,18 @@ T erf_imp(T z, bool invert, const Policy& pol, const Tag& t) result = tgamma_small_upper_part(T(0.5f), x, pol); result /= sqrt(boost::math::constants::pi<T>()); } + else if(x > 1 / tools::epsilon<T>()) + { + // http://functions.wolfram.com/06.27.06.0006.02 + invert = !invert; + result = exp(-x) / (constants::root_pi<T>() * z); + } else { // Compute Q: invert = !invert; result = z * exp(-x); - result /= sqrt(boost::math::constants::pi<T>()); + result /= boost::math::constants::root_pi<T>(); result *= upper_gamma_fraction(T(0.5f), x, policies::get_epsilon<T, Policy>()); } } |