File indexing completed on 2025-01-30 09:45:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include <boost/math/policies/policy.hpp>
0020 #include <boost/math/special_functions/math_fwd.hpp>
0021 #include <limits>
0022 #include <ostream>
0023 #include <istream>
0024 #include <cmath>
0025
0026 #ifndef BOOST_MATH_STD_REAL_CONCEPT_HPP
0027 #define BOOST_MATH_STD_REAL_CONCEPT_HPP
0028
0029 namespace boost{ namespace math{
0030
0031 namespace concepts
0032 {
0033
0034 #ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
0035 typedef double std_real_concept_base_type;
0036 #else
0037 typedef long double std_real_concept_base_type;
0038 #endif
0039
0040 class std_real_concept
0041 {
0042 public:
0043
0044 std_real_concept() : m_value(0){}
0045 std_real_concept(char c) : m_value(c){}
0046 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
0047 std_real_concept(wchar_t c) : m_value(c){}
0048 #endif
0049 std_real_concept(unsigned char c) : m_value(c){}
0050 std_real_concept(signed char c) : m_value(c){}
0051 std_real_concept(unsigned short c) : m_value(c){}
0052 std_real_concept(short c) : m_value(c){}
0053 std_real_concept(unsigned int c) : m_value(c){}
0054 std_real_concept(int c) : m_value(c){}
0055 std_real_concept(unsigned long c) : m_value(c){}
0056 std_real_concept(long c) : m_value(c){}
0057 #if defined(__DECCXX) || defined(__SUNPRO_CC)
0058 std_real_concept(unsigned long long c) : m_value(static_cast<std_real_concept_base_type>(c)){}
0059 std_real_concept(long long c) : m_value(static_cast<std_real_concept_base_type>(c)){}
0060 #endif
0061 std_real_concept(unsigned long long c) : m_value(static_cast<std_real_concept_base_type>(c)){}
0062 std_real_concept(long long c) : m_value(static_cast<std_real_concept_base_type>(c)){}
0063 std_real_concept(float c) : m_value(c){}
0064 std_real_concept(double c) : m_value(c){}
0065 std_real_concept(long double c) : m_value(c){}
0066 #ifdef BOOST_MATH_USE_FLOAT128
0067 std_real_concept(BOOST_MATH_FLOAT128_TYPE c) : m_value(c){}
0068 #endif
0069
0070
0071 std_real_concept& operator=(char c) { m_value = c; return *this; }
0072 std_real_concept& operator=(unsigned char c) { m_value = c; return *this; }
0073 std_real_concept& operator=(signed char c) { m_value = c; return *this; }
0074 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
0075 std_real_concept& operator=(wchar_t c) { m_value = c; return *this; }
0076 #endif
0077 std_real_concept& operator=(short c) { m_value = c; return *this; }
0078 std_real_concept& operator=(unsigned short c) { m_value = c; return *this; }
0079 std_real_concept& operator=(int c) { m_value = c; return *this; }
0080 std_real_concept& operator=(unsigned int c) { m_value = c; return *this; }
0081 std_real_concept& operator=(long c) { m_value = c; return *this; }
0082 std_real_concept& operator=(unsigned long c) { m_value = c; return *this; }
0083 #if defined(__DECCXX) || defined(__SUNPRO_CC)
0084 std_real_concept& operator=(unsigned long long c) { m_value = static_cast<std_real_concept_base_type>(c); return *this; }
0085 std_real_concept& operator=(long long c) { m_value = static_cast<std_real_concept_base_type>(c); return *this; }
0086 #endif
0087 std_real_concept& operator=(long long c) { m_value = static_cast<std_real_concept_base_type>(c); return *this; }
0088 std_real_concept& operator=(unsigned long long c) { m_value = static_cast<std_real_concept_base_type>(c); return *this; }
0089
0090 std_real_concept& operator=(float c) { m_value = c; return *this; }
0091 std_real_concept& operator=(double c) { m_value = c; return *this; }
0092 std_real_concept& operator=(long double c) { m_value = c; return *this; }
0093
0094
0095 std_real_concept_base_type value()const{ return m_value; }
0096
0097
0098 std_real_concept& operator+=(const std_real_concept& other)
0099 { m_value += other.value(); return *this; }
0100 std_real_concept& operator-=(const std_real_concept& other)
0101 { m_value -= other.value(); return *this; }
0102 std_real_concept& operator*=(const std_real_concept& other)
0103 { m_value *= other.value(); return *this; }
0104 std_real_concept& operator/=(const std_real_concept& other)
0105 { m_value /= other.value(); return *this; }
0106 std_real_concept operator-()const
0107 { return -m_value; }
0108 std_real_concept const& operator+()const
0109 { return *this; }
0110
0111 private:
0112 std_real_concept_base_type m_value;
0113 };
0114
0115
0116 inline std_real_concept operator+(const std_real_concept& a, const std_real_concept& b)
0117 {
0118 std_real_concept result(a);
0119 result += b;
0120 return result;
0121 }
0122 inline std_real_concept operator-(const std_real_concept& a, const std_real_concept& b)
0123 {
0124 std_real_concept result(a);
0125 result -= b;
0126 return result;
0127 }
0128 inline std_real_concept operator*(const std_real_concept& a, const std_real_concept& b)
0129 {
0130 std_real_concept result(a);
0131 result *= b;
0132 return result;
0133 }
0134 inline std_real_concept operator/(const std_real_concept& a, const std_real_concept& b)
0135 {
0136 std_real_concept result(a);
0137 result /= b;
0138 return result;
0139 }
0140
0141
0142 inline bool operator == (const std_real_concept& a, const std_real_concept& b)
0143 { return a.value() == b.value(); }
0144 inline bool operator != (const std_real_concept& a, const std_real_concept& b)
0145 { return a.value() != b.value();}
0146 inline bool operator < (const std_real_concept& a, const std_real_concept& b)
0147 { return a.value() < b.value(); }
0148 inline bool operator <= (const std_real_concept& a, const std_real_concept& b)
0149 { return a.value() <= b.value(); }
0150 inline bool operator > (const std_real_concept& a, const std_real_concept& b)
0151 { return a.value() > b.value(); }
0152 inline bool operator >= (const std_real_concept& a, const std_real_concept& b)
0153 { return a.value() >= b.value(); }
0154
0155 }
0156 }
0157 }
0158
0159 namespace std{
0160
0161
0162 inline boost::math::concepts::std_real_concept acos(boost::math::concepts::std_real_concept a)
0163 { return std::acos(a.value()); }
0164 inline boost::math::concepts::std_real_concept cos(boost::math::concepts::std_real_concept a)
0165 { return std::cos(a.value()); }
0166 inline boost::math::concepts::std_real_concept asin(boost::math::concepts::std_real_concept a)
0167 { return std::asin(a.value()); }
0168 inline boost::math::concepts::std_real_concept atan(boost::math::concepts::std_real_concept a)
0169 { return std::atan(a.value()); }
0170 inline boost::math::concepts::std_real_concept atan2(boost::math::concepts::std_real_concept a, boost::math::concepts::std_real_concept b)
0171 { return std::atan2(a.value(), b.value()); }
0172 inline boost::math::concepts::std_real_concept ceil(boost::math::concepts::std_real_concept a)
0173 { return std::ceil(a.value()); }
0174 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
0175 inline boost::math::concepts::std_real_concept fmod(boost::math::concepts::std_real_concept a, boost::math::concepts::std_real_concept b)
0176 { return fmodl(a.value(), b.value()); }
0177 #else
0178 inline boost::math::concepts::std_real_concept fmod(boost::math::concepts::std_real_concept a, boost::math::concepts::std_real_concept b)
0179 { return std::fmod(a.value(), b.value()); }
0180 #endif
0181 inline boost::math::concepts::std_real_concept cosh(boost::math::concepts::std_real_concept a)
0182 { return std::cosh(a.value()); }
0183 inline boost::math::concepts::std_real_concept exp(boost::math::concepts::std_real_concept a)
0184 { return std::exp(a.value()); }
0185 inline boost::math::concepts::std_real_concept fabs(boost::math::concepts::std_real_concept a)
0186 { return std::fabs(a.value()); }
0187 inline boost::math::concepts::std_real_concept abs(boost::math::concepts::std_real_concept a)
0188 { return std::abs(a.value()); }
0189 inline boost::math::concepts::std_real_concept floor(boost::math::concepts::std_real_concept a)
0190 { return std::floor(a.value()); }
0191 inline boost::math::concepts::std_real_concept modf(boost::math::concepts::std_real_concept a, boost::math::concepts::std_real_concept* ipart)
0192 {
0193 boost::math::concepts::std_real_concept_base_type ip;
0194 boost::math::concepts::std_real_concept_base_type result = std::modf(a.value(), &ip);
0195 *ipart = ip;
0196 return result;
0197 }
0198 inline boost::math::concepts::std_real_concept frexp(boost::math::concepts::std_real_concept a, int* expon)
0199 { return std::frexp(a.value(), expon); }
0200 inline boost::math::concepts::std_real_concept ldexp(boost::math::concepts::std_real_concept a, int expon)
0201 { return std::ldexp(a.value(), expon); }
0202 inline boost::math::concepts::std_real_concept log(boost::math::concepts::std_real_concept a)
0203 { return std::log(a.value()); }
0204 inline boost::math::concepts::std_real_concept log10(boost::math::concepts::std_real_concept a)
0205 { return std::log10(a.value()); }
0206 inline boost::math::concepts::std_real_concept tan(boost::math::concepts::std_real_concept a)
0207 { return std::tan(a.value()); }
0208 inline boost::math::concepts::std_real_concept pow(boost::math::concepts::std_real_concept a, boost::math::concepts::std_real_concept b)
0209 { return std::pow(a.value(), b.value()); }
0210 #if !defined(__SUNPRO_CC)
0211 inline boost::math::concepts::std_real_concept pow(boost::math::concepts::std_real_concept a, int b)
0212 { return std::pow(a.value(), b); }
0213 #else
0214 inline boost::math::concepts::std_real_concept pow(boost::math::concepts::std_real_concept a, int b)
0215 { return std::pow(a.value(), static_cast<long double>(b)); }
0216 #endif
0217 inline boost::math::concepts::std_real_concept sin(boost::math::concepts::std_real_concept a)
0218 { return std::sin(a.value()); }
0219 inline boost::math::concepts::std_real_concept sinh(boost::math::concepts::std_real_concept a)
0220 { return std::sinh(a.value()); }
0221 inline boost::math::concepts::std_real_concept sqrt(boost::math::concepts::std_real_concept a)
0222 { return std::sqrt(a.value()); }
0223 inline boost::math::concepts::std_real_concept tanh(boost::math::concepts::std_real_concept a)
0224 { return std::tanh(a.value()); }
0225 inline boost::math::concepts::std_real_concept (nextafter)(boost::math::concepts::std_real_concept a, boost::math::concepts::std_real_concept b)
0226 { return (boost::math::nextafter)(a, b); }
0227
0228
0229
0230
0231
0232 inline boost::math::concepts::std_real_concept asinh(boost::math::concepts::std_real_concept a)
0233 { return boost::math::asinh(a.value(), boost::math::policies::make_policy(boost::math::policies::overflow_error<boost::math::policies::ignore_error>())); }
0234 inline boost::math::concepts::std_real_concept acosh(boost::math::concepts::std_real_concept a)
0235 { return boost::math::acosh(a.value(), boost::math::policies::make_policy(boost::math::policies::overflow_error<boost::math::policies::ignore_error>())); }
0236 inline boost::math::concepts::std_real_concept atanh(boost::math::concepts::std_real_concept a)
0237 { return boost::math::atanh(a.value(), boost::math::policies::make_policy(boost::math::policies::overflow_error<boost::math::policies::ignore_error>())); }
0238 inline bool (isfinite)(boost::math::concepts::std_real_concept a)
0239 {
0240 return (boost::math::isfinite)(a.value());
0241 }
0242
0243
0244 }
0245
0246 #include <boost/math/special_functions/round.hpp>
0247 #include <boost/math/special_functions/trunc.hpp>
0248 #include <boost/math/special_functions/modf.hpp>
0249 #include <boost/math/tools/precision.hpp>
0250
0251 namespace boost{ namespace math{ namespace concepts{
0252
0253
0254
0255
0256 template <class Policy>
0257 inline int iround(const concepts::std_real_concept& v, const Policy& pol)
0258 {
0259 return boost::math::iround(v.value(), pol);
0260 }
0261 inline int iround(const concepts::std_real_concept& v)
0262 {
0263 return boost::math::iround(v.value(), policies::policy<>());
0264 }
0265
0266 template <class Policy>
0267 inline long lround(const concepts::std_real_concept& v, const Policy& pol)
0268 {
0269 return boost::math::lround(v.value(), pol);
0270 }
0271 inline long lround(const concepts::std_real_concept& v)
0272 {
0273 return boost::math::lround(v.value(), policies::policy<>());
0274 }
0275
0276 template <class Policy>
0277 inline long long llround(const concepts::std_real_concept& v, const Policy& pol)
0278 {
0279 return boost::math::llround(v.value(), pol);
0280 }
0281 inline long long llround(const concepts::std_real_concept& v)
0282 {
0283 return boost::math::llround(v.value(), policies::policy<>());
0284 }
0285
0286 template <class Policy>
0287 inline int itrunc(const concepts::std_real_concept& v, const Policy& pol)
0288 {
0289 return boost::math::itrunc(v.value(), pol);
0290 }
0291 inline int itrunc(const concepts::std_real_concept& v)
0292 {
0293 return boost::math::itrunc(v.value(), policies::policy<>());
0294 }
0295
0296 template <class Policy>
0297 inline long ltrunc(const concepts::std_real_concept& v, const Policy& pol)
0298 {
0299 return boost::math::ltrunc(v.value(), pol);
0300 }
0301 inline long ltrunc(const concepts::std_real_concept& v)
0302 {
0303 return boost::math::ltrunc(v.value(), policies::policy<>());
0304 }
0305
0306 template <class Policy>
0307 inline long long lltrunc(const concepts::std_real_concept& v, const Policy& pol)
0308 {
0309 return boost::math::lltrunc(v.value(), pol);
0310 }
0311 inline long long lltrunc(const concepts::std_real_concept& v)
0312 {
0313 return boost::math::lltrunc(v.value(), policies::policy<>());
0314 }
0315
0316
0317 template <class charT, class traits>
0318 inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& os, const std_real_concept& a)
0319 {
0320 return os << a.value();
0321 }
0322 template <class charT, class traits>
0323 inline std::basic_istream<charT, traits>& operator>>(std::basic_istream<charT, traits>& is, std_real_concept& a)
0324 {
0325 #if defined(__SGI_STL_PORT) || defined(_RWSTD_VER) || defined(__LIBCOMO__) || defined(_LIBCPP_VERSION)
0326 std::string s;
0327 std_real_concept_base_type d;
0328 is >> s;
0329 std::sscanf(s.c_str(), "%Lf", &d);
0330 a = d;
0331 return is;
0332 #else
0333 std_real_concept_base_type v;
0334 is >> v;
0335 a = v;
0336 return is;
0337 #endif
0338 }
0339
0340 }
0341 }}
0342
0343 #include <boost/math/tools/big_constant.hpp>
0344
0345 namespace boost{ namespace math{
0346 namespace tools
0347 {
0348
0349 template <>
0350 inline concepts::std_real_concept make_big_value<concepts::std_real_concept>(boost::math::tools::largest_float val, const char*, std::false_type const&, std::false_type const&)
0351 {
0352 return val;
0353 }
0354
0355 template <>
0356 inline concepts::std_real_concept max_value<concepts::std_real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
0357 {
0358 return max_value<concepts::std_real_concept_base_type>();
0359 }
0360
0361 template <>
0362 inline concepts::std_real_concept min_value<concepts::std_real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
0363 {
0364 return min_value<concepts::std_real_concept_base_type>();
0365 }
0366
0367 template <>
0368 inline concepts::std_real_concept log_max_value<concepts::std_real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
0369 {
0370 return log_max_value<concepts::std_real_concept_base_type>();
0371 }
0372
0373 template <>
0374 inline concepts::std_real_concept log_min_value<concepts::std_real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
0375 {
0376 return log_min_value<concepts::std_real_concept_base_type>();
0377 }
0378
0379 template <>
0380 inline concepts::std_real_concept epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept))
0381 {
0382 return tools::epsilon<concepts::std_real_concept_base_type>();
0383 }
0384
0385 template <>
0386 inline constexpr int digits<concepts::std_real_concept>(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::std_real_concept)) noexcept
0387 {
0388
0389 return digits<concepts::std_real_concept_base_type>();
0390 }
0391
0392 template <>
0393 inline double real_cast<double, concepts::std_real_concept>(concepts::std_real_concept r)
0394 {
0395 return static_cast<double>(r.value());
0396 }
0397
0398
0399 }
0400
0401 #if defined(_MSC_VER) && (_MSC_VER <= 1310)
0402 using concepts::itrunc;
0403 using concepts::ltrunc;
0404 using concepts::lltrunc;
0405 using concepts::iround;
0406 using concepts::lround;
0407 using concepts::llround;
0408 #endif
0409
0410 }
0411 }
0412
0413
0414
0415
0416
0417 #include <boost/math/special_functions/acosh.hpp>
0418 #include <boost/math/special_functions/asinh.hpp>
0419 #include <boost/math/special_functions/atanh.hpp>
0420
0421 #endif