summaryrefslogtreecommitdiff
path: root/boost/math/distributions/cauchy.hpp
diff options
context:
space:
mode:
authorChanho Park <chanho61.park@samsung.com>2014-12-11 18:55:56 +0900
committerChanho Park <chanho61.park@samsung.com>2014-12-11 18:55:56 +0900
commit08c1e93fa36a49f49325a07fe91ff92c964c2b6c (patch)
tree7a7053ceb8874b28ec4b868d4c49b500008a102e /boost/math/distributions/cauchy.hpp
parentbb4dd8289b351fae6b55e303f189127a394a1edd (diff)
downloadboost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.gz
boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.bz2
boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.zip
Imported Upstream version 1.57.0upstream/1.57.0
Diffstat (limited to 'boost/math/distributions/cauchy.hpp')
-rw-r--r--boost/math/distributions/cauchy.hpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/boost/math/distributions/cauchy.hpp b/boost/math/distributions/cauchy.hpp
index 0c93febaa5..5a3a64f0f2 100644
--- a/boost/math/distributions/cauchy.hpp
+++ b/boost/math/distributions/cauchy.hpp
@@ -152,13 +152,13 @@ public:
typedef RealType value_type;
typedef Policy policy_type;
- cauchy_distribution(RealType location = 0, RealType scale = 1)
- : m_a(location), m_hg(scale)
+ cauchy_distribution(RealType l_location = 0, RealType l_scale = 1)
+ : m_a(l_location), m_hg(l_scale)
{
static const char* function = "boost::math::cauchy_distribution<%1%>::cauchy_distribution";
RealType result;
- detail::check_location(function, location, &result, Policy());
- detail::check_scale(function, scale, &result, Policy());
+ detail::check_location(function, l_location, &result, Policy());
+ detail::check_scale(function, l_scale, &result, Policy());
} // cauchy_distribution
RealType location()const
@@ -180,15 +180,30 @@ typedef cauchy_distribution<double> cauchy;
template <class RealType, class Policy>
inline const std::pair<RealType, RealType> range(const cauchy_distribution<RealType, Policy>&)
{ // Range of permissible values for random variable x.
+ if (std::numeric_limits<RealType>::has_infinity)
+ {
+ return std::pair<RealType, RealType>(-std::numeric_limits<RealType>::infinity(), std::numeric_limits<RealType>::infinity()); // - to + infinity.
+ }
+ else
+ { // Can only use max_value.
using boost::math::tools::max_value;
- return std::pair<RealType, RealType>(-max_value<RealType>(), max_value<RealType>()); // - to + infinity.
+ return std::pair<RealType, RealType>(-max_value<RealType>(), max_value<RealType>()); // - to + max.
+ }
}
template <class RealType, class Policy>
inline const std::pair<RealType, RealType> support(const cauchy_distribution<RealType, Policy>& )
{ // Range of supported values for random variable x.
// This is range where cdf rises from 0 to 1, and outside it, the pdf is zero.
- return std::pair<RealType, RealType>(-tools::max_value<RealType>(), tools::max_value<RealType>()); // - to + infinity.
+ if (std::numeric_limits<RealType>::has_infinity)
+ {
+ return std::pair<RealType, RealType>(-std::numeric_limits<RealType>::infinity(), std::numeric_limits<RealType>::infinity()); // - to + infinity.
+ }
+ else
+ { // Can only use max_value.
+ using boost::math::tools::max_value;
+ return std::pair<RealType, RealType>(-tools::max_value<RealType>(), max_value<RealType>()); // - to + max.
+ }
}
template <class RealType, class Policy>