File indexing completed on 2025-01-18 09:39:33
0001
0002
0003
0004
0005
0006 #ifndef BOOST_MATH_COMPLEX_DETAILS_INCLUDED
0007 #define BOOST_MATH_COMPLEX_DETAILS_INCLUDED
0008
0009
0010
0011
0012
0013
0014 #include <cmath>
0015 #include <complex>
0016 #include <limits>
0017 #include <boost/math/special_functions/sign.hpp>
0018 #include <boost/math/special_functions/fpclassify.hpp>
0019 #include <boost/math/constants/constants.hpp>
0020
0021 namespace boost{ namespace math{ namespace detail{
0022
0023 template <class T>
0024 inline T mult_minus_one(const T& t)
0025 {
0026 return (boost::math::isnan)(t) ? t : (boost::math::changesign)(t);
0027 }
0028
0029 template <class T>
0030 inline std::complex<T> mult_i(const std::complex<T>& t)
0031 {
0032 return std::complex<T>(mult_minus_one(t.imag()), t.real());
0033 }
0034
0035 template <class T>
0036 inline std::complex<T> mult_minus_i(const std::complex<T>& t)
0037 {
0038 return std::complex<T>(t.imag(), mult_minus_one(t.real()));
0039 }
0040
0041 template <class T>
0042 inline T safe_max(T t)
0043 {
0044 return std::sqrt((std::numeric_limits<T>::max)()) / t;
0045 }
0046 inline long double safe_max(long double t)
0047 {
0048
0049
0050 return std::sqrt((std::numeric_limits<double>::max)()) / t;
0051 }
0052
0053 template <class T>
0054 inline T safe_min(T t)
0055 {
0056 return std::sqrt((std::numeric_limits<T>::min)()) * t;
0057 }
0058 inline long double safe_min(long double t)
0059 {
0060
0061
0062 return std::sqrt((std::numeric_limits<double>::min)()) * t;
0063 }
0064
0065 } } }
0066
0067 #endif
0068