diff options
Diffstat (limited to 'boost/math/special_functions/cbrt.hpp')
-rw-r--r-- | boost/math/special_functions/cbrt.hpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/boost/math/special_functions/cbrt.hpp b/boost/math/special_functions/cbrt.hpp index 0fc6e0742a..c34ad39949 100644 --- a/boost/math/special_functions/cbrt.hpp +++ b/boost/math/special_functions/cbrt.hpp @@ -68,7 +68,8 @@ T cbrt_imp(T z, const Policy& pol) static_cast<T>(1.2599210498948731647672106072782), // 2^1/3 static_cast<T>(1.5874010519681994747517056392723), // 2^2/3 }; - + if((boost::math::isinf)(z) || (z == 0)) + return z; if(!(boost::math::isfinite)(z)) { return policies::raise_domain_error("boost::math::cbrt<%1%>(%1%)", "Argument to function must be finite but got %1%.", z, pol); @@ -80,8 +81,6 @@ T cbrt_imp(T z, const Policy& pol) z = -z; sign = -sign; } - if(z == 0) - return 0; T guess = frexp(z, &i_exp); int original_i_exp = i_exp; // save for later |