// (C) Copyright John Maddock 2005. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MATH_COMPLEX_DETAILS_INCLUDED #define BOOST_MATH_COMPLEX_DETAILS_INCLUDED // // This header contains all the support code that is common to the // inverse trig complex functions, it also contains all the includes // that we need to implement all these functions. // #include #include #include #include #include #include namespace boost{ namespace math{ namespace detail{ template inline T mult_minus_one(const T& t) { return (boost::math::isnan)(t) ? t : (boost::math::changesign)(t); } template inline std::complex mult_i(const std::complex& t) { return std::complex(mult_minus_one(t.imag()), t.real()); } template inline std::complex mult_minus_i(const std::complex& t) { return std::complex(t.imag(), mult_minus_one(t.real())); } template inline T safe_max(T t) { return std::sqrt((std::numeric_limits::max)()) / t; } inline long double safe_max(long double t) { // long double sqrt often returns infinity due to // insufficient internal precision: return std::sqrt((std::numeric_limits::max)()) / t; } template inline T safe_min(T t) { return std::sqrt((std::numeric_limits::min)()) * t; } inline long double safe_min(long double t) { // long double sqrt often returns zero due to // insufficient internal precision: return std::sqrt((std::numeric_limits::min)()) * t; } } } } // namespaces #endif // BOOST_MATH_COMPLEX_DETAILS_INCLUDED