2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-29 19:52:08 +00:00

Changed range to include infinity if supported.

[SVN r78766]
This commit is contained in:
Paul A. Bristow
2012-05-30 16:31:18 +00:00
parent 187960b9a7
commit 7ef962fc6b

View File

@@ -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>